Fix compile-time errors for C# binding on Windows

This commit is contained in:
Joseph Henry
2021-05-11 14:34:22 -07:00
parent 1ea88d045f
commit 64fe1d015d
3 changed files with 15 additions and 34 deletions

View File

@@ -94,10 +94,10 @@ function Build-All
function BuildNuGetPackages([string]$Version)
{
BuildNuGetPackage-Sockets -BuildType "Release" -Arch "x64" -Version $Version
BuildNuGetPackage-Sockets -BuildType "Debug" -Arch "x64" -Version $Version
BuildNuGetPackage-Sockets -BuildType "Release" -Arch "Win32" -Version $Version
BuildNuGetPackage-Sockets -BuildType "Debug" -Arch "Win32" -Version $Version
BuildNuGetPackage -BuildType "Release" -Arch "x64" -Version $Version
BuildNuGetPackage -BuildType "Debug" -Arch "x64" -Version $Version
BuildNuGetPackage -BuildType "Release" -Arch "Win32" -Version $Version
BuildNuGetPackage -BuildType "Debug" -Arch "Win32" -Version $Version
}
function BuildNuGetPackage([string]$BuildType, [string]$Arch, [string]$Version)

19
src/bindings/csharp/Node.cs Executable file → Normal file
View File

@@ -175,7 +175,7 @@ namespace ZeroTier.Core
newEvent.NetworkInfo = ni;
newEvent.NetworkInfo.Id = net_info.net_id;
newEvent.NetworkInfo.MACAddress = net_info.mac;
newEvent.NetworkInfo.Name = System.Text.Encoding.Default.GetString(net_info.name);
newEvent.NetworkInfo.Name = System.Text.Encoding.UTF8.GetString(net_info.name);
newEvent.NetworkInfo.Status = net_info.status;
newEvent.NetworkInfo.Type = net_info.type;
newEvent.NetworkInfo.MTU = net_info.mtu;
@@ -581,7 +581,7 @@ namespace ZeroTier.Core
}
[DllImport("libzt", CharSet = CharSet.Ansi, EntryPoint = "CSharp_zts_id_new")] static extern int
zts_id_new(string arg1, global::System.Runtime.InteropServices.HandleRef arg2);
zts_id_new(string arg1, IntPtr arg2);
[DllImport("libzt", CharSet = CharSet.Ansi, EntryPoint = "CSharp_zts_id_pair_is_valid")]
static extern int zts_id_pair_is_valid(string arg1, int arg2);
@@ -660,24 +660,19 @@ namespace ZeroTier.Core
static extern int zts_addr_is_assigned(ulong arg1, int arg2);
[DllImport("libzt", EntryPoint = "CSharp_zts_addr_get")]
static extern int zts_addr_get(ulong arg1, int arg2, global::System.Runtime.InteropServices.HandleRef arg3);
static extern int zts_addr_get(ulong arg1, int arg2, IntPtr arg3);
[DllImport("libzt", CharSet = CharSet.Ansi, EntryPoint = "CSharp_zts_addr_get_str")]
static extern int zts_addr_get_str(ulong arg1, int arg2, IntPtr arg3, int arg4);
[DllImport("libzt", EntryPoint = "CSharp_zts_addr_get_all")]
static extern int zts_addr_get_all(
ulong arg1,
global::System.Runtime.InteropServices.HandleRef arg2,
global::System.Runtime.InteropServices.HandleRef arg3);
static extern int zts_addr_get_all(ulong arg1, IntPtr arg2, IntPtr arg3);
[DllImport("libzt", EntryPoint = "CSharp_zts_addr_compute_6plane")]
static extern int
zts_addr_compute_6plane(ulong arg1, ulong arg2, global::System.Runtime.InteropServices.HandleRef arg3);
static extern int zts_addr_compute_6plane(ulong arg1, ulong arg2, IntPtr arg3);
[DllImport("libzt", EntryPoint = "CSharp_zts_addr_compute_rfc4193")]
static extern int
zts_addr_compute_rfc4193(ulong arg1, ulong arg2, global::System.Runtime.InteropServices.HandleRef arg3);
static extern int zts_addr_compute_rfc4193(ulong arg1, ulong arg2, IntPtr arg3);
[DllImport("libzt", CharSet = CharSet.Ansi, EntryPoint = "CSharp_zts_addr_compute_rfc4193_str")]
static extern int zts_addr_compute_rfc4193_str(ulong arg1, ulong arg2, string arg3, int arg4);
@@ -745,7 +740,7 @@ namespace ZeroTier.Core
public static extern ulong zts_node_get_id();
[DllImport("libzt", CharSet = CharSet.Ansi, EntryPoint = "CSharp_zts_node_get_id_pair")]
static extern int zts_node_get_id_pair(string arg1, global::System.Runtime.InteropServices.HandleRef arg2);
static extern int zts_node_get_id_pair(string arg1, IntPtr arg2);
[DllImport("libzt", EntryPoint = "CSharp_zts_node_get_port")]
static extern int zts_node_get_port();

View File

@@ -490,12 +490,7 @@ namespace ZeroTier.Sockets
zts_bsd_gethostbyname(string jarg1);
[DllImport("libzt", EntryPoint = "CSharp_zts_bsd_select")]
static extern int zts_bsd_select(
int jarg1,
global::System.Runtime.InteropServices.HandleRef jarg2,
global::System.Runtime.InteropServices.HandleRef jarg3,
global::System.Runtime.InteropServices.HandleRef jarg4,
global::System.Runtime.InteropServices.HandleRef jarg5);
static extern int zts_bsd_select(int jarg1, IntPtr jarg2, IntPtr jarg3, IntPtr jarg4, IntPtr jarg5);
[DllImport("libzt", EntryPoint = "CSharp_zts_get_all_stats")]
static extern int zts_get_all_stats(IntPtr arg1);
@@ -663,12 +658,7 @@ namespace ZeroTier.Sockets
static extern int zts_tcp_client(string jarg1, int jarg2);
[DllImport("libzt", CharSet = CharSet.Ansi, EntryPoint = "CSharp_zts_tcp_server")]
static extern int zts_tcp_server(
string jarg1,
int jarg2,
string jarg3,
int jarg4,
global::System.Runtime.InteropServices.HandleRef jarg5);
static extern int zts_tcp_server(string jarg1, int jarg2, string jarg3, int jarg4, IntPtr jarg5);
[DllImport("libzt", CharSet = CharSet.Ansi, EntryPoint = "CSharp_zts_udp_server")]
static extern int zts_udp_server(string jarg1, int jarg2);
@@ -683,7 +673,7 @@ namespace ZeroTier.Sockets
static extern int zts_connect(int jarg1, string jarg2, int jarg3, int jarg4);
[DllImport("libzt", EntryPoint = "CSharp_zts_stats_get_all")]
static extern int zts_stats_get_all(global::System.Runtime.InteropServices.HandleRef jarg1);
static extern int zts_stats_get_all(IntPtr jarg1);
/*
[DllImport("libzt", EntryPoint = "CSharp_zts_set_no_delay")]
@@ -760,11 +750,7 @@ namespace ZeroTier.Sockets
static extern int zts_util_get_ip_family(string jarg1);
[DllImport("libzt", CharSet = CharSet.Ansi, EntryPoint = "CSharp_zts_util_ipstr_to_saddr")]
static extern int zts_util_ipstr_to_saddr(
string jarg1,
int jarg2,
global::System.Runtime.InteropServices.HandleRef jarg3,
global::System.Runtime.InteropServices.HandleRef jarg4);
static extern int zts_util_ipstr_to_saddr(string jarg1, int jarg2, IntPtr jarg3, IntPtr jarg4);
/// <value>The value of errno for the low-level socket layer</value>
public static int ErrNo