From 1e2a3cae1037941be8d5cce14d46b54ada1e2104 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Fri, 8 Jan 2021 14:45:00 -0800 Subject: [PATCH] Calling convention fix for C# callback delegate from C++ --- examples/csharp/Node.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/csharp/Node.cs b/examples/csharp/Node.cs index 05f4b38..89b79e0 100644 --- a/examples/csharp/Node.cs +++ b/examples/csharp/Node.cs @@ -15,6 +15,7 @@ using System.Runtime.InteropServices; using System; // Prototype of callback used by ZeroTier to signal events to C# application +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void CSharpCallbackWithStruct(IntPtr msgPtr); /// @@ -473,7 +474,7 @@ namespace ZeroTier struct zts_callback_msg { public short eventCode; - [MarshalAs(UnmanagedType.LPStruct, SizeConst = 4)] + //[MarshalAs(UnmanagedType.LPStruct, SizeConst = 4)] public IntPtr node; public IntPtr network; }