libcommonc++
0.7
|
An encapsulation of a dynamically loadable module, such as a shared library or object file on UNIX systems or a DLL on Windows. More...
#include <LoadableModule.h++>
Public Member Functions | |
LoadableModule (const String &path=String::null) | |
Construct a LoadableModule for the loadable object specified by the given path. More... | |
~LoadableModule () | |
Destructor. More... | |
void | open () |
Open the loadable object file. More... | |
void | close () |
Close the loadable object file. More... | |
bool | isOpen () const |
Determine if the object file has been opened. More... | |
void * | lookup (const char *symbol) |
Look up a symbol within the loadable object. More... | |
void * | lookup (const String &symbol) |
Look up a symbol within the loadable object. More... | |
void * | operator[] (const char *symbol) |
Look up a symbol within the loadable object. More... | |
void * | operator[] (const String &symbol) |
Look up a symbol within the loadable object. More... | |
void | setPath (const String &path) |
Set the object file path. More... | |
String | getPath () const |
Get the object file path. More... | |
Static Public Member Functions | |
static String | getExtension () |
Get the filename extension for loadable objects (shared libraries) on the host system. More... | |
static String | getPrefix () |
Get the filename prefix for loadable objects (shared libraries) on the host system. More... | |
static String | fileNameForStem (const String &stem) |
Construct a complete filename for a loadable module stem based on the conventions of the host system. More... | |
static String | fileNameForStem (const String &stem, const Version &version) |
Construct a complete filename for a shared library stem and version based on the conventions of the host system. More... | |
static bool | isLoadableModuleFile (const String &fileName) |
Test a filename to determine if it matches the naming convention for shared libraries on the host system. More... | |
An encapsulation of a dynamically loadable module, such as a shared library or object file on UNIX systems or a DLL on Windows.
Note that on Mac OS X, loadable modules are expected to have an ".so" extension, which is in more common use than the ".bundle" extension recommended by Apple.
LoadableModule | ( | const String & | path = String::null | ) |
Construct a LoadableModule for the loadable object specified by the given path.
path | The path to the object file. If the path is empty or null, the module will represent the calling executable itself. |
~LoadableModule | ( | ) |
Destructor.
Closes the object file.
void close | ( | ) |
Close the loadable object file.
Construct a complete filename for a loadable module stem based on the conventions of the host system.
For example, "foo" produces "foo.dll" on Windows, and "libfoo.so" on Mac OS X and all other (POSIX) systems.
stem | The stem. |
Construct a complete filename for a shared library stem and version based on the conventions of the host system.
For example, a stem of "foo" and version of "9:0:6" produces "foo-3.dll" on Windows, "libfoo.3.6.0.so" on Mac OS X, and "libfoo.so.3.6.0" on all other (POSIX) systems. (Note that a loadable module on Mac OS X may also have the extension ".bundle", though ".so" is more commonly used.)
stem | The stem. |
version | The version. |
|
static |
Get the filename extension for loadable objects (shared libraries) on the host system.
This returns "dll" on Windows, "so" on Mac OS X, and "so" on all other (POSIX) systems.
|
inline |
Get the object file path.
|
static |
Get the filename prefix for loadable objects (shared libraries) on the host system.
This returns "lib" on POSIX systems (including Mac OS X) and an empty string on Windows.
|
static |
Test a filename to determine if it matches the naming convention for shared libraries on the host system.
fileName | The filename to test. |
|
inline |
Determine if the object file has been opened.
void * lookup | ( | const char * | symbol | ) |
Look up a symbol within the loadable object.
symbol | The symbol to look up. |
void * lookup | ( | const String & | symbol | ) |
Look up a symbol within the loadable object.
symbol | The symbol to look up. |
void open | ( | ) |
Open the loadable object file.
IOException | If the object could not be loaded, or if no path has been specified. |
|
inline |
Look up a symbol within the loadable object.
symbol | The symbol to look up. |
|
inline |
Look up a symbol within the loadable object.
symbol | The symbol to look up. |
|
inline |
Set the object file path.
If the object file is open, the call has no effect.