private ReturnCode AttachMarshalerDelegates(IntPtr ts, DatabaseMarshaler marshaler) { Gapi._TypeSupport typeSupport = null; IntPtr tsPtr = IntPtr.Zero; ReturnCode result = ReturnCode.Ok; typeSupport = Gapi.TypeSupport.Claim(ts, out tsPtr, ref result); if (result == ReturnCode.Ok) { typeSupport.copy_in = marshaler.CopyInDelegate; // HACK: This is a Mono workaround. Currently you cannot marshal a delegate // to a function pointer if the parameters include an "object" type. So we // will pass a fake delegate, and then internally use the real copyOut, this // may give better performance anyways, since we won't have to convert the // IntPtr to a Delegate for every ReaderCopy invocation. typeSupport.copy_out = marshaler.CopyOutDelegate; typeSupport.reader_copy = marshaler.ReaderCopyDelegate; Gapi.TypeSupport.Release(typeSupport, tsPtr); } return(result); }
public static IntPtr Release(_TypeSupport typeSupport, IntPtr tsPtr) { Marshal.StructureToPtr(typeSupport, tsPtr, false); return(Gapi.Object.Release(tsPtr)); }
public static IntPtr Release(_TypeSupport typeSupport, IntPtr tsPtr) { Marshal.StructureToPtr(typeSupport, tsPtr, false); return Gapi.Object.Release(tsPtr); }