[Mono-dev] PInvoke : argument passing by ref

Shankari shankari82 at yahoo.com
Sat Oct 22 22:43:50 EDT 2005


I am trying to isolate the updates by unmanaged code
if the arguments are passed by reference in Pinvoke.

I looked up marshal.c and at
mono_marshal_emit_native_wrapper , the by-ref
argumments are being marshalled back to managed

I am trying to do this by the foll :

After the C code has made the updates : when the
results are being marshalled back to the managed
object, I can copy this to a diff location  and return
this address and thus prevent the original argument
from being updated.

I could do this at call time , by copying the managed
structure to another location and passing this
addr...and this can get updated..but in this case I
have to change the final byref argument to point to
this new address.

Everything leads to mono_mb_emit_byte( where some copy
actually seems to be happening..) but it emits IL code
and it *seems* to be pushing similar stuff if I pass
by value or by reference.

Any pointers on how to achieve my objective ??


Yahoo! Mail - PC Magazine Editors' Choice 2005 

More information about the Mono-devel-list mailing list