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

Rafael Teixeira monoman at gmail.com
Tue Mar 29 09:37:27 EST 2005


The enum definition may alter it's base type from the default int (32
bit) to a smaller/bigger integer. I think the marshalling 'magic',
sees this and tries to accomodate to the calling convention (in some
conventions 8-bit bytes are pushed as 32 bit integer to keep the stack
aligned).

enums are value types and as such are always passed by-value, unless
the ref or out modifier is applied to the parameter definition.

I don't think you can easily identify sizes form the c side as it
would be too late, you need to confirm the enum base time from
inspecting the sources or the defining assembly with monodis/monop,
and code correctly the c part.

HIH,


On Tue, 29 Mar 2005 06:27:19 +0200, Joe Ante <joe at otee.dk> wrote:
> Hi,
> 
> I am calling a c function using mono's internal call. In the function call i
> am passing a C# enum into the c function.
> 
> How do i determine the size of the enum in the c code? It seems to be passed
> by value and accepting it as a 4 byte integer seems to work but is that
> always correct?
> 
> Joachim Ante
> www.otee.dk
> 
> _______________________________________________
> 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