LLVM API Documentation
#include <DynamicLibrary.h>
Collaboration diagram for llvm::sys::DynamicLibrary:
Implementation | |
DynamicLibrary (const DynamicLibrary &) | |
Do not implement. | |
DynamicLibrary & | operator= (const DynamicLibrary &) |
void * | handle |
Public Member Functions | |
Constructors | |
DynamicLibrary () | |
Open program as dynamic library. | |
DynamicLibrary (const char *filename) | |
Open a dynamic library. | |
~DynamicLibrary () | |
Closes the DynamicLibrary. | |
Accessors | |
void * | GetAddressOfSymbol (const char *symbolName) |
Get the address of a symbol in the DynamicLibrary. | |
void * | GetAddressOfSymbol (const std::string &symbolName) |
Convenience function for C++ophiles. | |
Static Public Member Functions | |
Functions | |
static void | LoadLibraryPermanently (const char *filename) |
Open a dynamic library permanently. | |
static void * | SearchForAddressOfSymbol (const char *symbolName) |
Search through libraries for address of a symbol. | |
static void * | SearchForAddressOfSymbol (const std::string &symbolName) |
Convenience function for C++ophiles. |
This class provides a portable interface to dynamic libraries which also might be known as shared libraries, shared objects, dynamic shared objects, or dynamic link libraries. Regardless of the terminology or the operating system interface, this class provides a portable interface that allows dynamic libraries to be loaded and and searched for externally defined symbols. This is typically used to provide "plug-in" support.
Definition at line 31 of file DynamicLibrary.h.
|
Open program as dynamic library. Construct a DynamicLibrary that represents the currently executing program. The program must have been linked with -export-dynamic or -dlopen self for this to work. Any symbols retrieved with the GetAddressOfSymbol function will refer to the program not to any library.
Definition at line 37 of file DynamicLibrary.cpp. References check_ltdl_initialization(), handle, lt_dlopen(), and OpenedHandles. |
|
Open a dynamic library. This is the constructor for DynamicLibrary instances. It will open the dynamic library specified by the Path.
Definition at line 49 of file DynamicLibrary.cpp. References check_ltdl_initialization(), handle, lt_dlerror(), lt_dlopen(), lt_dlopenext(), and OpenedHandles. |
|
Closes the DynamicLibrary. After destruction, the symbols of the library will no longer be available to the program. It is important to make sure the lifespan of a DynamicLibrary exceeds the lifetime of the pointers returned by the GetAddressOfSymbol otherwise the program may walk off into uncharted territory.
Definition at line 64 of file DynamicLibrary.cpp. References E, handle, I, lt_dlclose(), and OpenedHandles. |
|
Do not implement.
|
|
Convenience function for C++ophiles.
Definition at line 95 of file DynamicLibrary.h. References GetAddressOfSymbol(). |
|
Get the address of a symbol in the DynamicLibrary.
Looks up a
Definition at line 133 of file DynamicLibrary.cpp. References handle, and lt_dlsym(). Referenced by GetAddressOfSymbol(). |
|
Open a dynamic library permanently. This function allows a library to be loaded without instantiating a DynamicLibrary object. Consequently, it is marked as being permanent and will only be unloaded when the program terminates.
Definition at line 79 of file DynamicLibrary.cpp. References check_ltdl_initialization(), lt_dlerror(), lt_dlmakeresident(), lt_dlopen(), lt_dlopenext(), and OpenedHandles. Referenced by llvm::ExecutionEngine::create(), and llvm::PluginLoader::operator=(). |
|
Do not implement |
|
Convenience function for C++ophiles.
Definition at line 80 of file DynamicLibrary.h. References SearchForAddressOfSymbol(). |
|
Search through libraries for address of a symbol.
This function will search through all previously loaded dynamic libraries for the symbol
Definition at line 94 of file DynamicLibrary.cpp. References check_ltdl_initialization(), E, I, lt_dlsym(), lt_ptr, and OpenedHandles. Referenced by llvm::ExecutionEngine::emitGlobals(), llvm::JIT::getOrEmitGlobalVariable(), llvm::JIT::getPointerToNamedFunction(), lookupFunction(), and SearchForAddressOfSymbol(). |
|
Definition at line 103 of file DynamicLibrary.h. Referenced by DynamicLibrary(), GetAddressOfSymbol(), and ~DynamicLibrary(). |