MCPcopy Create free account
hub / github.com/apple/foundationdb / loadLibrary

Function loadLibrary

flow/Platform.actor.cpp:3459–3484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3457}
3458
3459void* loadLibrary(const char* lib_path) {
3460#if !defined(__linux__) && !defined(__APPLE__) && !defined(_WIN32) && !defined(__FreeBSD__)
3461#error Port me!
3462#endif
3463
3464 void* dlobj = nullptr;
3465
3466#if defined(__unixish__)
3467 dlobj = dlopen(lib_path,
3468 RTLD_LAZY | RTLD_LOCAL
3469#ifdef USE_SANITIZER // Keep alive dlopen()-ed libs for symbolized XSAN backtrace
3470 | RTLD_NODELETE
3471#endif
3472 );
3473 if (dlobj == nullptr) {
3474 TraceEvent(SevWarn, "LoadLibraryFailed").detail("Library", lib_path).detail("Error", dlerror());
3475 }
3476#else
3477 dlobj = LoadLibrary(lib_path);
3478 if (dlobj == nullptr) {
3479 TraceEvent(SevWarn, "LoadLibraryFailed").detail("Library", lib_path).GetLastError();
3480 }
3481#endif
3482
3483 return dlobj;
3484}
3485
3486void* loadFunction(void* lib, const char* func_name) {
3487 void* dlfcn = nullptr;

Callers 3

ExternalWorkloadMethod · 0.85
loadPluginFunction · 0.85
initMethod · 0.85

Calls 2

TraceEventClass · 0.85
detailMethod · 0.80

Tested by

no test coverage detected