diff --git a/CMakeLists.txt b/CMakeLists.txt index 59f6ec32..f4761f58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,6 +63,7 @@ add_library(labview_grpc_server SHARED src/message_element_metadata_owner.cc src/any_support.cc src/unpacked_fields.cc + src/grpc_load.cc ) target_link_libraries(labview_grpc_server ${_REFLECTION} diff --git a/src/grpc_load.cc b/src/grpc_load.cc new file mode 100644 index 00000000..0be6263e --- /dev/null +++ b/src/grpc_load.cc @@ -0,0 +1,26 @@ +#ifndef _WIN32 +#include +#else +#include +#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(); +} \ No newline at end of file