#include <shared_library.h>
◆ Flags
枚举值 |
---|
SHLIB_GLOBAL | |
SHLIB_LOCAL | |
在文件 shared_library.h 第 42 行定义.
42 {
43
44
46
47
48
49
50
51
52
54 };
◆ SharedLibrary() [1/4]
apollo::cyber::class_loader::SharedLibrary::SharedLibrary |
( |
| ) |
|
|
default |
◆ ~SharedLibrary()
apollo::cyber::class_loader::SharedLibrary::~SharedLibrary |
( |
| ) |
|
|
virtual |
◆ SharedLibrary() [2/4]
apollo::cyber::class_loader::SharedLibrary::SharedLibrary |
( |
const std::string & |
path | ) |
|
|
explicit |
◆ SharedLibrary() [3/4]
apollo::cyber::class_loader::SharedLibrary::SharedLibrary |
( |
const std::string & |
path, |
|
|
int |
flags |
|
) |
| |
◆ SharedLibrary() [4/4]
apollo::cyber::class_loader::SharedLibrary::SharedLibrary |
( |
const SharedLibrary & |
| ) |
|
|
delete |
◆ GetPath()
const std::string & apollo::cyber::class_loader::SharedLibrary::GetPath |
( |
| ) |
const |
|
inline |
◆ GetSymbol()
void * apollo::cyber::class_loader::SharedLibrary::GetSymbol |
( |
const std::string & |
name | ) |
|
在文件 shared_library.cc 第 78 行定义.
78 {
79 std::lock_guard<std::mutex> lock(mutex_);
80 if (!handle_) return nullptr;
81
82 void* result = dlsym(handle_, name.c_str());
83 if (!result) {
84 throw SymbolNotFoundException(name);
85 }
86
87 return result;
88}
◆ HasSymbol()
bool apollo::cyber::class_loader::SharedLibrary::HasSymbol |
( |
const std::string & |
name | ) |
|
◆ IsLoaded()
bool apollo::cyber::class_loader::SharedLibrary::IsLoaded |
( |
| ) |
|
在文件 shared_library.cc 第 69 行定义.
69 {
70 std::lock_guard<std::mutex> lock(mutex_);
71 return handle_ != nullptr;
72}
◆ Load() [1/2]
void apollo::cyber::class_loader::SharedLibrary::Load |
( |
const std::string & |
path | ) |
|
◆ Load() [2/2]
void apollo::cyber::class_loader::SharedLibrary::Load |
( |
const std::string & |
path, |
|
|
int |
flags |
|
) |
| |
在文件 shared_library.cc 第 42 行定义.
42 {
43 std::lock_guard<std::mutex> lock(mutex_);
44 if (handle_) throw LibraryAlreadyLoadedException(path);
45
46 int real_flag = RTLD_LAZY;
48 real_flag |= RTLD_LOCAL;
49 } else {
50 real_flag |= RTLD_GLOBAL;
51 }
52 handle_ = dlopen(path.c_str(), real_flag);
53 if (!handle_) {
54 const char*
err = dlerror();
55 throw LibraryLoadException(err ? std::string(err) : path);
56 }
57
58 path_ = path;
59}
◆ operator=()
◆ Unload()
void apollo::cyber::class_loader::SharedLibrary::Unload |
( |
| ) |
|
在文件 shared_library.cc 第 61 行定义.
61 {
62 std::lock_guard<std::mutex> lock(mutex_);
63 if (handle_) {
64 dlclose(handle_);
65 handle_ = nullptr;
66 }
67}
该类的文档由以下文件生成: