Sirikata
|
DynamicLibrary represents a dynamically loadable module. More...
#include <DynamicLibrary.hpp>
Public Member Functions | |
DynamicLibrary (const String &path) | |
~DynamicLibrary () | |
bool | load () |
bool | unload () |
void * | symbol (const String &name) const |
Static Public Member Functions | |
static void | Initialize () |
static void | AddLoadPath (const String &path) |
static String | prefix () |
Get the standard platform-specific library filename prefix. | |
static String | postfix () |
Get the standard, build specific platform-specific library filename postfix. | |
static String | extension () |
Get the standard platform-specific library filename extension. | |
static String | filename (const String &path, const String &name) |
Construct a platform dependent filename for a dynamic library based on a path and library name. | |
static String | filename (const String &name) |
Construct a platform dependent filename for a dynamic library. | |
static void | gc (DL_HANDLE handle=NULL) |
Actually unloads program code of module in use Useful to wait until relevant global variables are purged (c.f. | |
Private Member Functions | |
bool | isValidLibraryFilename () const |
Returns true if the library's filename matches the pattern required for shared libraries on this platform. | |
Private Attributes | |
String | mPath |
DL_HANDLE | mHandle |
DynamicLibrary represents a dynamically loadable module.
This only handles loading, unloading, and symbol lookup. This presumes nothing about the interface provided by the module.
Sirikata::DynamicLibrary::DynamicLibrary | ( | const String & | path | ) |
void Sirikata::DynamicLibrary::AddLoadPath | ( | const String & | path | ) | [static] |
References LD_LIBRARY_PATH_STR.
Referenced by Initialize(), main(), and Sirikata::Graphics::WebViewManager::WebViewManager().
String Sirikata::DynamicLibrary::extension | ( | ) | [static] |
Get the standard platform-specific library filename extension.
Referenced by filename(), and isValidLibraryFilename().
String Sirikata::DynamicLibrary::filename | ( | const String & | path, |
const String & | name | ||
) | [static] |
Construct a platform dependent filename for a dynamic library based on a path and library name.
Referenced by Sirikata::PluginManager::load().
String Sirikata::DynamicLibrary::filename | ( | const String & | name | ) | [static] |
Construct a platform dependent filename for a dynamic library.
The result will be relative to the current path.
References extension(), postfix(), and prefix().
void Sirikata::DynamicLibrary::gc | ( | DL_HANDLE | handle = NULL | ) | [static] |
Actually unloads program code of module in use Useful to wait until relevant global variables are purged (c.f.
Options)
Referenced by ~DynamicLibrary().
void Sirikata::DynamicLibrary::Initialize | ( | ) | [static] |
References AddLoadPath(), Sirikata::Path::DIR_CURRENT, Sirikata::Path::DIR_EXE, Sirikata::Path::DIR_EXE_BUNDLE, and Sirikata::Path::Get().
Referenced by main().
bool Sirikata::DynamicLibrary::isValidLibraryFilename | ( | ) | const [private] |
Returns true if the library's filename matches the pattern required for shared libraries on this platform.
References extension(), mPath, and prefix().
Referenced by load().
bool Sirikata::DynamicLibrary::load | ( | ) |
References isValidLibraryFilename(), mHandle, mPath, SILOG, SIRIKATA_DLOPEN_FLAGS, and Sirikata::Logging::warning.
Referenced by Sirikata::Plugin::load().
String Sirikata::DynamicLibrary::postfix | ( | ) | [static] |
Get the standard, build specific platform-specific library filename postfix.
Referenced by filename().
String Sirikata::DynamicLibrary::prefix | ( | ) | [static] |
Get the standard platform-specific library filename prefix.
Referenced by filename(), and isValidLibraryFilename().
void * Sirikata::DynamicLibrary::symbol | ( | const String & | name | ) | const |
References mHandle.
Referenced by Sirikata::Plugin::load().
bool Sirikata::DynamicLibrary::unload | ( | ) |
References mHandle.
Referenced by Sirikata::Plugin::unload().
DL_HANDLE Sirikata::DynamicLibrary::mHandle [private] |
Referenced by load(), symbol(), unload(), and ~DynamicLibrary().
String Sirikata::DynamicLibrary::mPath [private] |
Referenced by isValidLibraryFilename(), and load().