[Mono-list] P/Invoke return MonoObject*
Robert Jordan
robertj at gmx.net
Fri Aug 5 04:39:21 EDT 2011
On 05.08.2011 05:54, Xavier Amado wrote:
> 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?
While P/Invokes do not support arbitrary objects in signatures,
I-calls were designed to support exactly that, because they
don't perform any marshaling.
Robert
More information about the Mono-list
mailing list