View previous topic :: View next topic |
Author |
Message |
gperiskic
Joined: 18 Dec 2009 Posts: 34 Location: Stuttgart, Germany
|
Posted: Sun Mar 04, 2012 11:27 am Post subject: Usage of ENUM Type |
|
|
Hello,
according to the revision history, in rev. 6.20 the ENUM Type has been implemented, however there is no any documentation how to use/define it - or at least I cannot find in the help.
I would like the use the ENUM type as an argument in calling a .NET method in FTN95 (the method is defined in C#). Is there a way to do this with the new feature?
Best regards,
Goran |
|
Back to top |
|
 |
mecej4
Joined: 31 Oct 2006 Posts: 1899
|
Posted: Sun Mar 04, 2012 11:49 am Post subject: Re: Usage of ENUM Type |
|
|
Open ftn95.chm and look up ENUM. Note that this feature is different from the enumerators of Fortran 2003. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8209 Location: Salford, UK
|
Posted: Sun Mar 04, 2012 4:38 pm Post subject: |
|
|
I will have to check the details but ENUM was incorrectly documented in the help file. I have recently added, what should be a standard conforming implementation of ENUM. I will aim to check this tomorrow and get back to you. As far a .NET is concerned, an FTN95 ENUM will just appear as an INTEGER of default KIND. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8209 Location: Salford, UK
|
Posted: Mon Mar 05, 2012 11:21 am Post subject: |
|
|
The topic in the help file on ".NET enumerated types" should be ignored. I will remove it for the next release.
The following code works OK for .NET but not for Win32. I will log this as a bug that needs fixing.
Code: | ENUM,bind(C)
ENUMERATOR::RED = 4, BLUE = 9
ENUMERATOR YELLOW
END ENUM
if(RED==4.AND.BLUE==9.AND.YELLOW==10) print*,"Success"
END
|
|
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8209 Location: Salford, UK
|
Posted: Mon Mar 05, 2012 11:40 am Post subject: |
|
|
Correction: The code above does work when you use /f2k on the command line. So I will have to investigate why this option is not needed for .NET. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8209 Location: Salford, UK
|
Posted: Mon Mar 05, 2012 11:52 am Post subject: |
|
|
/clr implies /f2k as it says in the help file. So everything is OK apart from the erroneous topic on ".NET enumerated types" which I will remove. |
|
Back to top |
|
 |
|