[Mono-devel-list] Custom Marshalling

Kornél Pál kornelpal at hotmail.com
Mon Jul 18 14:05:53 EDT 2005

According to my experiences by-ref (out is by-ref as well) custom marshaling
is not supported in either runtime. Could you attach please a full test code
(managed and umnanaged source code) to can I try it?


----- Original Message -----
From: Jonathan S. Chambers

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

[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
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?


Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com

More information about the Mono-devel-list mailing list