MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / load

Method load

src/shared_library_UNIX.cpp:13–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11SharedLibrary::SharedLibrary() = default;
12
13void SharedLibrary::load(const std::string& path, int)
14{
15 const std::unique_lock<std::mutex> lock(_mutex);
16
17 if(_handle != nullptr)
18 {
19 throw RuntimeError("Library already loaded: " + path);
20 }
21
22 _handle = dlopen(path.c_str(), RTLD_NOW | RTLD_GLOBAL);
23 if(_handle == nullptr)
24 {
25 const char* err = dlerror();
26 throw RuntimeError("Could not load library: " +
27 (err != nullptr ? std::string(err) : path));
28 }
29 _path = path;
30}
31
32void SharedLibrary::unload()
33{

Callers

nothing calls this directly

Calls 2

RuntimeErrorClass · 0.85
stringFunction · 0.85

Tested by

no test coverage detected