[Mono-list] P/Invoke return MonoObject*

Xavier Amado xamado at gmail.com
Thu Aug 4 23:54:55 EDT 2011


I'm currently experimenting with embedding mono into a C++ project.
Most of the C++ portion of the code is in a C++ DLL, while the
Application just links against this dll. I've been using P/Invoke to
call stuff from the library and everything is working fine, except
when I want to return a MonoObject*. When some objects are created on
the C++ side, I create a "mirror" of it on the managed side, and keep
a reference to the MonoObject on the C++ object. Now I need to define
a method that returns this MonoObject as a proper managed object to
the C# side. I've been able to do this fine using internal calls, but
I can't seem to get it to work with P/Invoke, so the question simply
is, is this possible or it just won't work and I need to stick to
internal calls?

Regards,
Xavier


More information about the Mono-list mailing list