[Mono-dev] Embedding Mono and HandleRef...
Thomas Wiest
twiest at novell.com
Sat Dec 30 20:32:34 EST 2006
Hey,
I'm using the Mono embedding API and I'm using HandleRef's instead of
IntPtr's (as per the instructions on the interop page).
http://www.mono-project.com/Interop_with_Native_Libraries
However, the HandleRef's seem to only be marshaled to IntPtr's if you're
using p/invoke's. I've attached a tar ball with two examples of what I'm
trying to do. Both examples can be compiled and run using "make run".
The Dll_Import example works flawlessly, marshaling the HandleRef into
an IntPtr. The mono_embed fails miserably because the HandleRef is still
a MonoObject (notice the memory address' don't line up as they do in the
Dll_Import example).
From Robert Jordan's earlier e-mail it seems that the HandleRef is
intentionally not marshaled. So my question is, how do I get the
advantages of HandleRef's when using the embedding API? And if I just
switch back to IntPtr's, will my C# objects get collected before my
native code is done executing?
Thanks,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HandleRef-examples.tgz
Type: application/x-compressed-tar
Size: 1857 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061230/99f09d63/attachment.bin
More information about the Mono-devel-list
mailing list