[Mono-list] Reference/ Pointer passing

itsme notyou randombreaks at gmail.com
Fri Oct 21 04:38:32 EDT 2005


Hello,
 I am not clear about how the CLR will act if we pass a reference OR pointer
to a unmanaged code via Pinvoke. ( Both are treated alike with the only diff
being we need to encapsulate the code using '&' with UNSAFE and pin the
location ????? )
 I read the useful article by Jon Pryor (
http://www.mono-project.com/index.php?title=Interop_with_Native_Libraries&redirect=no).
It states the 4 steps for marshaling...what happens if you pass a
NON_BLITTABLE STRUCTURE by reference (without pinning it) or pass a pointer
to this structure.
 Will this be
 Content of pointer copied to UM memory---- > marshaling done --- > (
Unmanaged code makes operates on it / changes ) ---> result marshaled BACK
to managed types ---> result copied to managed memory
 And do the above steps take place for "class pass by reference" ???
 Awaiting some reply from the experts out there !!
  Thanks!
Sanjay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20051021/444ef5c0/attachment.html


More information about the Mono-list mailing list