|
|
|
@ -114,6 +114,10 @@ namespace Grpc.Core.Internal |
|
|
|
|
{ |
|
|
|
|
return Mono.dlsym(this.handle, symbolName); |
|
|
|
|
} |
|
|
|
|
if (PlatformApis.IsNetCore) |
|
|
|
|
{ |
|
|
|
|
return CoreCLR.dlsym(this.handle, symbolName); |
|
|
|
|
} |
|
|
|
|
return Linux.dlsym(this.handle, symbolName); |
|
|
|
|
} |
|
|
|
|
if (PlatformApis.IsMacOSX) |
|
|
|
@ -149,6 +153,10 @@ namespace Grpc.Core.Internal |
|
|
|
|
{ |
|
|
|
|
return Mono.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY); |
|
|
|
|
} |
|
|
|
|
if (PlatformApis.IsNetCore) |
|
|
|
|
{ |
|
|
|
|
return CoreCLR.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY); |
|
|
|
|
} |
|
|
|
|
return Linux.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY); |
|
|
|
|
} |
|
|
|
|
if (PlatformApis.IsMacOSX) |
|
|
|
@ -215,5 +223,19 @@ namespace Grpc.Core.Internal |
|
|
|
|
[DllImport("__Internal")] |
|
|
|
|
internal static extern IntPtr dlsym(IntPtr handle, string symbol); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Similarly as for Mono on Linux, we load symbols for |
|
|
|
|
/// dlopen and dlsym from the "libcoreclr.so", |
|
|
|
|
/// to avoid the dependency on libc-dev Linux. |
|
|
|
|
/// </summary> |
|
|
|
|
private static class CoreCLR |
|
|
|
|
{ |
|
|
|
|
[DllImport("libcoreclr.so")] |
|
|
|
|
internal static extern IntPtr dlopen(string filename, int flags); |
|
|
|
|
|
|
|
|
|
[DllImport("libcoreclr.so")] |
|
|
|
|
internal static extern IntPtr dlsym(IntPtr handle, string symbol); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|