diff --git a/src/csharp/GrpcCore/GrpcEnvironment.cs b/src/csharp/GrpcCore/GrpcEnvironment.cs index 7a644f49619..201320828bd 100644 --- a/src/csharp/GrpcCore/GrpcEnvironment.cs +++ b/src/csharp/GrpcCore/GrpcEnvironment.cs @@ -13,10 +13,10 @@ namespace Google.GRPC.Core { const int THREAD_POOL_SIZE = 1; - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_init(); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_shutdown(); static object staticLock = new object(); diff --git a/src/csharp/GrpcCore/Internal/CallSafeHandle.cs b/src/csharp/GrpcCore/Internal/CallSafeHandle.cs index 6c9c58a4c3f..bbb830b3552 100644 --- a/src/csharp/GrpcCore/Internal/CallSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/CallSafeHandle.cs @@ -15,66 +15,66 @@ namespace Google.GRPC.Core.Internal { const UInt32 GRPC_WRITE_BUFFER_HINT = 1; - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern CallSafeHandle grpc_channel_create_call_old(ChannelSafeHandle channel, string method, string host, Timespec deadline); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_add_metadata(CallSafeHandle call, IntPtr metadata, UInt32 flags); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_invoke_old(CallSafeHandle call, CompletionQueueSafeHandle cq, IntPtr metadataReadTag, IntPtr finishedTag, UInt32 flags); - [DllImport("libgrpc.so", EntryPoint = "grpc_call_invoke_old")] + [DllImport("grpc.dll", EntryPoint = "grpc_call_invoke_old")] static extern GRPCCallError grpc_call_invoke_old_CALLBACK(CallSafeHandle call, CompletionQueueSafeHandle cq, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate metadataReadCallback, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate finishedCallback, UInt32 flags); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_server_accept_old(CallSafeHandle call, CompletionQueueSafeHandle completionQueue, IntPtr finishedTag); - [DllImport("libgrpc.so", EntryPoint = "grpc_call_server_accept_old")] + [DllImport("grpc.dll", EntryPoint = "grpc_call_server_accept_old")] static extern GRPCCallError grpc_call_server_accept_old_CALLBACK(CallSafeHandle call, CompletionQueueSafeHandle completionQueue, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate finishedCallback); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_server_end_initial_metadata_old(CallSafeHandle call, UInt32 flags); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_cancel(CallSafeHandle call); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_start_write_status_old(CallSafeHandle call, StatusCode statusCode, string statusMessage, IntPtr tag); - [DllImport("libgrpc.so", EntryPoint = "grpc_call_start_write_status_old")] + [DllImport("grpc.dll", EntryPoint = "grpc_call_start_write_status_old")] static extern GRPCCallError grpc_call_start_write_status_old_CALLBACK(CallSafeHandle call, StatusCode statusCode, string statusMessage, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_writes_done_old(CallSafeHandle call, IntPtr tag); - [DllImport("libgrpc.so", EntryPoint = "grpc_call_writes_done_old")] + [DllImport("grpc.dll", EntryPoint = "grpc_call_writes_done_old")] static extern GRPCCallError grpc_call_writes_done_old_CALLBACK(CallSafeHandle call, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_start_read_old(CallSafeHandle call, IntPtr tag); - [DllImport("libgrpc.so", EntryPoint = "grpc_call_start_read_old")] + [DllImport("grpc.dll", EntryPoint = "grpc_call_start_read_old")] static extern GRPCCallError grpc_call_start_read_old_CALLBACK(CallSafeHandle call, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern void grpc_call_start_write_from_copied_buffer(CallSafeHandle call, byte[] buffer, UIntPtr length, IntPtr tag, UInt32 flags); - [DllImport("libgrpc_csharp_ext.so", EntryPoint = "grpc_call_start_write_from_copied_buffer")] + [DllImport("grpc_csharp_ext.dll", EntryPoint = "grpc_call_start_write_from_copied_buffer")] static extern void grpc_call_start_write_from_copied_buffer_CALLBACK(CallSafeHandle call, byte[] buffer, UIntPtr length, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback, UInt32 flags); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_call_destroy(IntPtr call); private CallSafeHandle() diff --git a/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs b/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs index 3a09d8b1b64..0f38d63f98c 100644 --- a/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs @@ -10,10 +10,10 @@ namespace Google.GRPC.Core.Internal /// internal class ChannelSafeHandle : SafeHandleZeroIsInvalid { - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern ChannelSafeHandle grpc_channel_create(string target, IntPtr channelArgs); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_channel_destroy(IntPtr channel); private ChannelSafeHandle() diff --git a/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs b/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs index 73dd3edde33..f098de68205 100644 --- a/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs @@ -9,22 +9,22 @@ namespace Google.GRPC.Core.Internal /// internal class CompletionQueueSafeHandle : SafeHandleZeroIsInvalid { - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern CompletionQueueSafeHandle grpc_completion_queue_create(); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern EventSafeHandle grpc_completion_queue_pluck(CompletionQueueSafeHandle cq, IntPtr tag, Timespec deadline); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern EventSafeHandle grpc_completion_queue_next(CompletionQueueSafeHandle cq, Timespec deadline); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_completion_queue_shutdown(CompletionQueueSafeHandle cq); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern GRPCCompletionType grpc_completion_queue_next_with_callback(CompletionQueueSafeHandle cq); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_completion_queue_destroy(IntPtr cq); private CompletionQueueSafeHandle() diff --git a/src/csharp/GrpcCore/Internal/Event.cs b/src/csharp/GrpcCore/Internal/Event.cs index 7056005ba65..5853ddd5704 100644 --- a/src/csharp/GrpcCore/Internal/Event.cs +++ b/src/csharp/GrpcCore/Internal/Event.cs @@ -9,34 +9,34 @@ namespace Google.GRPC.Core.Internal /// internal class EventSafeHandle : SafeHandleZeroIsInvalid { - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_event_finish(IntPtr ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern GRPCCompletionType grpc_event_type(EventSafeHandle ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern CallSafeHandle grpc_event_call(EventSafeHandle ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern GRPCOpError grpc_event_write_accepted(EventSafeHandle ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern GRPCOpError grpc_event_finish_accepted(EventSafeHandle ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern StatusCode grpc_event_finished_status(EventSafeHandle ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern IntPtr grpc_event_finished_details(EventSafeHandle ev); // returns const char* - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern IntPtr grpc_event_read_length(EventSafeHandle ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern void grpc_event_read_copy_to_buffer(EventSafeHandle ev, byte[] buffer, UIntPtr bufferLen); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern IntPtr grpc_event_server_rpc_new_method(EventSafeHandle ev); // returns const char* public GRPCCompletionType GetCompletionType() @@ -98,34 +98,34 @@ namespace Google.GRPC.Core.Internal /// internal class EventSafeHandleNotOwned : SafeHandleZeroIsInvalid { - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_event_finish(IntPtr ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern GRPCCompletionType grpc_event_type(EventSafeHandleNotOwned ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern CallSafeHandle grpc_event_call(EventSafeHandleNotOwned ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern GRPCOpError grpc_event_write_accepted(EventSafeHandleNotOwned ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern GRPCOpError grpc_event_finish_accepted(EventSafeHandleNotOwned ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern StatusCode grpc_event_finished_status(EventSafeHandleNotOwned ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern IntPtr grpc_event_finished_details(EventSafeHandleNotOwned ev); // returns const char* - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern IntPtr grpc_event_read_length(EventSafeHandleNotOwned ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern void grpc_event_read_copy_to_buffer(EventSafeHandleNotOwned ev, byte[] buffer, UIntPtr bufferLen); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern IntPtr grpc_event_server_rpc_new_method(EventSafeHandleNotOwned ev); // returns const char* public EventSafeHandleNotOwned() : base(false) diff --git a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs index 08d4cf01927..d363b34f0b9 100644 --- a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs @@ -10,30 +10,30 @@ namespace Google.GRPC.Core.Internal /// internal sealed class ServerSafeHandle : SafeHandleZeroIsInvalid { - [DllImport("libgrpc.so", EntryPoint = "grpc_server_request_call_old")] + [DllImport("grpc.dll", EntryPoint = "grpc_server_request_call_old")] static extern GRPCCallError grpc_server_request_call_old_CALLBACK(ServerSafeHandle server, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern ServerSafeHandle grpc_server_create(CompletionQueueSafeHandle cq, IntPtr args); // TODO: check int representation size - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern int grpc_server_add_http2_port(ServerSafeHandle server, string addr); // TODO: check int representation size - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern int grpc_server_add_secure_http2_port(ServerSafeHandle server, string addr); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_server_start(ServerSafeHandle server); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_server_shutdown(ServerSafeHandle server); - [DllImport("libgrpc.so", EntryPoint = "grpc_server_shutdown_and_notify")] + [DllImport("grpc.dll", EntryPoint = "grpc_server_shutdown_and_notify")] static extern void grpc_server_shutdown_and_notify_CALLBACK(ServerSafeHandle server, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_server_destroy(IntPtr server); private ServerSafeHandle() diff --git a/src/csharp/GrpcCore/Internal/Timespec.cs b/src/csharp/GrpcCore/Internal/Timespec.cs index 8ffaf70bbfb..5a197e121c9 100644 --- a/src/csharp/GrpcCore/Internal/Timespec.cs +++ b/src/csharp/GrpcCore/Internal/Timespec.cs @@ -13,7 +13,7 @@ namespace Google.GRPC.Core.Internal const int nanosPerSecond = 1000 * 1000 * 1000; const int nanosPerTick = 100; - [DllImport("libgpr.so")] + [DllImport("gpr.dll")] static extern Timespec gpr_now(); // TODO: this only works on 64bit linux, can we autoselect the right size of ints?