[Mono-list] Custom Marshalling

Neale.Ferguson@SoftwareAG-USA.com Neale.Ferguson@SoftwareAG-USA.com
Thu, 28 Oct 2004 14:12:39 -0400


I've implemented some custom marshalling for an external call so that =
the parameters being sent gets massaged as required by the external =
routine. In addition, it is supposed to massage data after the call. =
However, while it will do so on the way out, it's not being driven the =
other way. I found that if I specified "ref" on the parameters being =
passed then the MarshalManagedToNative method will not be driven, if I =
specify nothing or "out" then neither the ToNative or ToManaged methods =
are being called.

                [DllImport(libname, EntryPoint =3D "scumbag")]
                private unsafe static extern void scumbag          (ref =
XXXCB cb,
                        [MarshalAs(UnmanagedType.CustomMarshaler,
                         MarshalTypeRef =3D typeof (AdaByteBuffer))] =
XXXBuffer fb,
                        [MarshalAs(UnmanagedType.CustomMarshaler,
                         MarshalTypeRef =3D typeof (AdaByteBuffer))] =
XXXBuffer rb,
                        [MarshalAs(UnmanagedType.CustomMarshaler,
                         MarshalTypeRef =3D typeof (AdaByteBuffer))] =
XXXBuffer sb,
                        [MarshalAs(UnmanagedType.CustomMarshaler,
                         MarshalTypeRef =3D typeof (AdaByteBuffer))] =
XXXBuffer vb,
                        [MarshalAs(UnmanagedType.CustomMarshaler,
                         MarshalTypeRef =3D typeof (AdaIntBuffer))]  =
XXXIB ib);


Neale=20