[Mono-list] Parameter passing using PInvoke
shankari82 at yahoo.com
Wed Oct 19 20:14:18 EDT 2005
I had the following question regarding parameter
passing in PInvoke:
If I pass a reference to a structure VIA PINVOKE how
do I know the size of the struct in Mono (at
Mono pushes the "address" on to the stack but is there
a way to retrieve the size of the struct pointed to by
mono_marshal_type_size doesnt seem to be the right
function..( I am not sure).
I dereferenced the pointer at the emit_native_wrapper
level as *(sig->params[i])->data.klass and the
instance size is shown as 24. where as my structre is
just has 4 integer values i.e 16 (obtained using
sizeof() in C# code)
If I need to copy this structure by value ...what size
should I be using = 16 or instance size of 24??
If it is 16 : How can we get this in *mono* (not at
the C# program level).
Also, If I pass a structure or class by reference
through Pinvoke, it would be visible "as such" to the
unmanaged code (without any marshalling). So, if at
all Pinvoke does padding , the unmanaged code would
access the datamembers as such. Is this correct?
Yahoo! Music Unlimited
Access over 1 million songs. Try it free.
More information about the Mono-list