[Mono-devel-list] Custom Marshalling

Jonathan S. Chambers Jonathan.Chambers at ansys.com
Mon Jul 18 13:58:58 EDT 2005


Hello All,
	I am trying to use a custom marshaler in mono. The marshaling
from managed to native is working great, but my custom marshalling code
is not getting hit for the native to managed case. Here are my pinvoke
signatures:

[DllImport(@"TestLib.dll", CallingConvention = CallingConvention.Cdecl)]
public extern static int
SetName([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef =
typeof(StringMarshaler))]string name);

[DllImport(@"TestLib.dll", CallingConvention = CallingConvention.Cdecl)]
public extern static int
GetName([MarshalAs(UnmanagedType.CustomMarshaler,MarshalTypeRef=typeof(S
tringMarshaler)), Out]out string name);

So my SetName function works fine, but when I call GetName the
MarshalNativeToManaged method on my custom marshaller is not getting
called (and it does in .Net). Any thoughts?

Thanks,
Jonathan




More information about the Mono-devel-list mailing list