20 #include "llvm/Config/config.h"
33 (*ExplicitSymbols)[symbolName] = symbolValue;
36 char llvm::sys::DynamicLibrary::Invalid = 0;
47 using namespace llvm::sys;
57 std::string *errMsg) {
60 void *handle = dlopen(filename, RTLD_LAZY|RTLD_GLOBAL);
62 if (errMsg) *errMsg = dlerror();
70 handle = RTLD_DEFAULT;
87 return dlsym(
Data, symbolName);
93 using namespace llvm::sys;
96 std::string *errMsg) {
97 if (errMsg) *errMsg =
"dlopen() not supported on this platform";
118 if (i != ExplicitSymbols->end())
128 void *ptr = dlsym(*
I, symbolName);
140 #define EXPLICIT_SYMBOL(SYM) \
141 if (!strcmp(symbolName, #SYM)) return &SYM
146 #if defined(__linux__) and !defined(__ANDROID__)
167 #undef EXPLICIT_SYMBOL
172 #endif // LLVM_ON_WIN32
bool isConstructed() const
isConstructed - Return true if this object has not been created yet.
static void * SearchForAddressOfSymbol(const char *symbolName)
This function will search through all previously loaded dynamic libraries for the symbol symbolName...
DenseSet - This implements a dense probed hash-table based set.
static llvm::ManagedStatic< llvm::sys::SmartMutex< true > > SymbolsMutex
void * getAddressOfSymbol(const char *symbolName)
Searches through the library for the symbol symbolName.
static bool LoadLibraryPermanently(const char *Filename, std::string *ErrMsg=nullptr)
This function permanently loads the dynamic library at the given path.
This class provides a portable interface to dynamic libraries which also might be known as shared lib...
static DenseSet< void * > * OpenedHandles
void * LLVMSearchForAddressOfSymbol(const char *symbolName)
This function will search through all previously loaded dynamic libraries for the symbol symbolName...
StringRef filename(StringRef path)
Get filename.
static void AddSymbol(StringRef symbolName, void *symbolValue)
This functions permanently adds the symbol symbolName with the value symbolValue. ...
void * SearchForAddressOfSpecialSymbol(const char *symbolName)
#define EXPLICIT_SYMBOL(SYM)
static llvm::ManagedStatic< llvm::StringMap< void * > > ExplicitSymbols
static DynamicLibrary getPermanentLibrary(const char *filename, std::string *errMsg=nullptr)
This function permanently loads the dynamic library at the given path.
LLVMBool LLVMLoadLibraryPermanently(const char *Filename)
This function permanently loads the dynamic library at the given path.
void LLVMAddSymbol(const char *symbolName, void *symbolValue)
This functions permanently adds the symbol symbolName with the value symbolValue. ...
StringRef - Represent a constant reference to a string, i.e.
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...