Silverfrost Forums

Welcome to our forums

Usage of ENUM Type

4 Mar 2012 10:27 #9747

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

4 Mar 2012 10:49 #9748

Open ftn95.chm and look up ENUM. Note that this feature is different from the enumerators of Fortran 2003.

4 Mar 2012 3:38 #9749

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.

5 Mar 2012 10:21 #9756

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.

ENUM,bind(C)
 ENUMERATOR::RED = 4, BLUE = 9
 ENUMERATOR YELLOW
END ENUM
if(RED==4.AND.BLUE==9.AND.YELLOW==10) print*,'Success'
END
5 Mar 2012 10:40 #9757

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.

5 Mar 2012 10:52 #9758

/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.

Please login to reply.