diff options
author | Jan Tattermusch <jtattermusch@google.com> | 2015-02-11 16:26:12 -0800 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@google.com> | 2015-02-11 16:26:12 -0800 |
commit | 20b738d778377ba84057dcba4b5a5c00d1a47c60 (patch) | |
tree | 7c751157aacdad4bca4e274b9d73deb34351c164 /src/csharp | |
parent | 630f1b842e4d4bfdd364b2f87fce53101f6267d4 (diff) |
reference windows-style library names in DllImport, mono still finds the right library
Diffstat (limited to 'src/csharp')
-rw-r--r-- | src/csharp/GrpcCore/GrpcEnvironment.cs | 4 | ||||
-rw-r--r-- | src/csharp/GrpcCore/Internal/CallSafeHandle.cs | 36 | ||||
-rw-r--r-- | src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs | 4 | ||||
-rw-r--r-- | src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs | 12 | ||||
-rw-r--r-- | src/csharp/GrpcCore/Internal/Event.cs | 40 | ||||
-rw-r--r-- | src/csharp/GrpcCore/Internal/ServerSafeHandle.cs | 16 | ||||
-rw-r--r-- | src/csharp/GrpcCore/Internal/Timespec.cs | 2 |
7 files changed, 57 insertions, 57 deletions
diff --git a/src/csharp/GrpcCore/GrpcEnvironment.cs b/src/csharp/GrpcCore/GrpcEnvironment.cs index 7a644f4961..201320828b 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 6c9c58a4c3..bbb830b355 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 3a09d8b1b6..0f38d63f98 100644 --- a/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs @@ -10,10 +10,10 @@ namespace Google.GRPC.Core.Internal /// </summary> 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 73dd3edde3..f098de6820 100644 --- a/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs @@ -9,22 +9,22 @@ namespace Google.GRPC.Core.Internal /// </summary> 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 7056005ba6..5853ddd570 100644 --- a/src/csharp/GrpcCore/Internal/Event.cs +++ b/src/csharp/GrpcCore/Internal/Event.cs @@ -9,34 +9,34 @@ namespace Google.GRPC.Core.Internal /// </summary> 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 /// </summary> 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 08d4cf0192..d363b34f0b 100644 --- a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs @@ -10,30 +10,30 @@ namespace Google.GRPC.Core.Internal /// </summary> 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 8ffaf70bbf..5a197e121c 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? |