Skip to content

Commit 46d56af

Browse files
authored
Merge pull request #550 from dmitriyse/core2-marshal-fix
Marshalling fix for 3-IntPtr args cdecl calls.
2 parents 7f81b38 + 580f13f commit 46d56af

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/runtime/nativecall.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ internal class NativeCall
2727
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
2828
private delegate void Void_1_Delegate(IntPtr a1);
2929

30-
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
31-
private delegate IntPtr IntPtr_3_Delegate(IntPtr a1, IntPtr a2, IntPtr a3);
32-
3330
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
3431
private delegate int Int_3_Delegate(IntPtr a1, IntPtr a2, IntPtr a3);
3532

@@ -40,7 +37,8 @@ public static void Void_Call_1(IntPtr fp, IntPtr a1)
4037

4138
public static IntPtr Call_3(IntPtr fp, IntPtr a1, IntPtr a2, IntPtr a3)
4239
{
43-
return ((IntPtr_3_Delegate)Marshal.GetDelegateForFunctionPointer(fp, typeof(IntPtr_3_Delegate)))(a1, a2, a3);
40+
var d = (Interop.TernaryFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(Interop.TernaryFunc));
41+
return d(a1, a2, a3);
4442
}
4543

4644

0 commit comments

Comments
 (0)