2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
42#include "core/DynamicLoader.h"
44#ifndef DOXYGEN_SHOULD_SKIP_THIS
46#include "log/Logger.h"
60 std::string result = libFile;
63 const std::filesystem::path p(libFile);
66 if (std::filesystem::exists(p)) {
67 result = std::filesystem::canonical(p).string();
77 void* handle =
nullptr;
94 if (handle !=
nullptr) {
105 LOG(TRACE) <<
"DynLoader dlOpen: " << libFile <<
": success";
115 if (handle ==
nullptr) {
116 LOG(TRACE) <<
"DynLoader dlCloseDelayed: handle is nullptr";
120 LOG(TRACE) <<
"DynLoader dlCloseDelayed: " << handle <<
": not opened using dlOpen";
124 LOG(TRACE) <<
"DynLoader: dlCloseDelayed: internal error: handle known but library record missing";
148 if (handle ==
nullptr) {
149 LOG(TRACE) <<
"DynLoader dlClose: handle is nullptr";
153 LOG(TRACE) <<
"DynLoader dlClose: " << handle <<
": not opened using dlOpen";
157 LOG(TRACE) <<
"DynLoader dlClose: internal error: handle known but library record missing";
212 for (
const std::string& canonicalFile :
closeQueue) {
static int realExecDlClose(const Library &library)
static int dlClose(void *handle)
static std::string canonicalizePath(const std::string &libFile)
static const char * dlError()
static void * dlSym(void *handle, const std::string &symbol)
static void * dlOpen(const std::string &libFile, int flags=RTLD_LOCAL|RTLD_LAZY)
static void execDlCloseDeleyed()
static std::map< void *, std::string > dlOpenedLibrariesByHandle
static std::map< std::string, Library > dlOpenedLibraries
static int dlClose(const Library &library)
static std::list< std::string > closeQueue
static void dlCloseDelayed(void *handle)
LogMessage(Level level, int verboseLevel=-1, bool withErrno=false)
int dlclose(void *handle)
void * dlsym(void *handle, const char *symbol)
void * dlopen(const char *filename, int flags)
std::string canonicalFileName