| 18 | #include <dlfcn.h> |
| 19 | |
| 20 | class DynamicLibrary |
| 21 | { |
| 22 | public: |
| 23 | DynamicLibrary(const char* cszPath) |
| 24 | { |
| 25 | m_handle = dlopen(cszPath, RTLD_LAZY); |
| 26 | } |
| 27 | |
| 28 | ~DynamicLibrary() |
| 29 | { |
| 30 | if(m_handle) |
| 31 | dlclose(m_handle); |
| 32 | } |
| 33 | |
| 34 | void * GetSymbol(const char* cszSymbol) const |
| 35 | { |
| 36 | if(!m_handle) |
| 37 | return NULL; |
| 38 | |
| 39 | return dlsym(m_handle, cszSymbol); |
| 40 | } |
| 41 | |
| 42 | bool IsLoaded() const |
| 43 | { |
| 44 | return m_handle != NULL; |
| 45 | } |
| 46 | |
| 47 | private: |
| 48 | void *m_handle; |
| 49 | |
| 50 | DynamicLibrary(const DynamicLibrary&); |
| 51 | void operator=(const DynamicLibrary&); |
| 52 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected