[Mono-devel-list] Enums in mono c api

Rafael Teixeira monoman at gmail.com
Thu Mar 31 09:22:40 EST 2005


In your example it will always be an int (32bit) because that is the
default basetype for all enums. To have it as a long, for instance,
you would need to explicitly define it with the proper basetype,
giving code like this:

enum FooEnum :  long { A = 0, B, C, D }

See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcreftheenumerationtypes.asp
for details.

HIH,

On Thu, 31 Mar 2005 15:57:34 +0200, Joe Ante <joe at otee.dk> wrote:
> > You need to know the type of the enum: ususally it's a int32, but
> > a different type can be specified. Since you must control the
> > assembly the icall is defined in, you should also know what type
> > the enum has.
> Ok so in C# when i write:
> 
> enum FooEnum { A = 0, B, C, D }
> 
> And then i have a icall which receives FooEnum, under what circumstances can
> FooEnum be passed as a non- int32?
> 
> I have control over the C# and C++ code that contains the dll and icalls.
> So how do i make sure they never become non-int32?
> 
> Joachim
> 
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 


-- 
Rafael "Monoman" Teixeira
---------------------------------------
I'm trying to become a "Rosh Gadol" before my own eyes. 
See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.
It hurts!



More information about the Mono-devel-list mailing list