-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure gRPC server dll is never unloaded from the process once it is …
…loaded (#143) * Fix crash while unloading labview-grpc dll * Ensure gRPC server dll is never unloaded from the process once it is loaded * Minor cleanup
- Loading branch information
1 parent
5adac80
commit b7418fb
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef _WIN32 | ||
#include <dlfcn.h> | ||
#else | ||
#include <wtypes.h> | ||
#endif | ||
|
||
namespace grpc_labview | ||
{ | ||
#ifndef _WIN32 | ||
typedef void* LibHandle; | ||
#else | ||
typedef HMODULE LibHandle; | ||
#endif | ||
|
||
LibHandle LockgRPCLibraryIntoProcessMem() | ||
{ | ||
#if _WIN32 | ||
auto dllHandle = LoadLibrary("labview_grpc_server.dll"); | ||
#else | ||
auto dllHandle = dlopen("liblabview_grpc_server.so", RTLD_LAZY); | ||
#endif | ||
return dllHandle; | ||
} | ||
|
||
LibHandle gSelfLibHandle = LockgRPCLibraryIntoProcessMem(); | ||
} |