LoadableModule Class Reference

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++>

Collaboration diagram for LoadableModule:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LoadableModule (const String &path=String::null)
 Construct a LoadableModule for the loadable object specified by the given path.
 ~LoadableModule () throw ()
 Destructor.
void open () throw (IOException)
 Open the loadable object file.
void close () throw ()
 Close the loadable object file.
bool isOpen () const throw ()
 Determine if the object file has been opened.
void * lookup (const char *symbol) throw ()
 Look up a symbol within the loadable object.
void * lookup (const String &symbol) throw ()
 Look up a symbol within the loadable object.
void * operator[] (const char *symbol) throw ()
 Look up a symbol within the loadable object.
void * operator[] (const String &symbol) throw ()
 Look up a symbol within the loadable object.
void setPath (const String &path) throw ()
 Set the object file path.
String getPath () const throw ()
 Get the object file path.

Static Public Member Functions

static String getExtension () throw ()
 Get the filename extension for loadable objects (shared libraries) on the host system.
static String getPrefix () throw ()
 Get the filename prefix for loadable objects (shared libraries) on the host system.
static String fileNameForStem (const String &stem) throw ()
 Construct a complete filename for a loadable module stem based on the conventions of the host system.
static String fileNameForStem (const String &stem, const Version &version) throw ()
 Construct a complete filename for a shared library stem and version based on the conventions of the host system.
static bool isLoadableModuleFile (const String &fileName) throw ()
 Test a filename to determine if it matches the naming convention for shared libraries on the host system.

Detailed Description

An encapsulation of a dynamically loadable module, such as a shared library or object file on UNIX systems or a DLL on Windows.

Author:
Mark Lindner

Constructor & Destructor Documentation

LoadableModule ( const String path = String::null  ) 

Construct a LoadableModule for the loadable object specified by the given path.

Parameters:
path The path to the object file.
~LoadableModule (  )  throw ()

Destructor.

Closes the object file.


Member Function Documentation

void close (  )  throw ()

Close the loadable object file.

String fileNameForStem ( const String stem,
const Version version 
) throw () [static]

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.)

Parameters:
stem The stem.
version The version.
Returns:
The complete filename.
String fileNameForStem ( const String stem  )  throw () [static]

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.

Parameters:
stem The stem.
Returns:
The complete filename.
String getExtension (  )  throw () [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.

String getPath (  )  const throw () [inline]

Get the object file path.

String getPrefix (  )  throw () [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.

bool isLoadableModuleFile ( const String fileName  )  throw () [static]

Test a filename to determine if it matches the naming convention for shared libraries on the host system.

Parameters:
fileName The filename to test.
bool isOpen (  )  const throw () [inline]

Determine if the object file has been opened.

void* lookup ( const String symbol  )  throw () [inline]

Look up a symbol within the loadable object.

Parameters:
symbol The symbol to look up.
Returns:
A pointer to the symbol, or NULL if the symbol was not found, or if the file is not open.
void * lookup ( const char *  symbol  )  throw ()

Look up a symbol within the loadable object.

Parameters:
symbol The symbol to look up.
Returns:
A pointer to the symbol, or NULL if the symbol was not found, or if the file is not open.
void open (  )  throw (IOException)

Open the loadable object file.

Exceptions:
IOException If the object could not be loaded, or if no path has been specified.
void* operator[] ( const String symbol  )  throw () [inline]

Look up a symbol within the loadable object.

Parameters:
symbol The symbol to look up.
Returns:
A pointer to the symbol, or NULL if the symbol was not found, or if the file is not open.
void* operator[] ( const char *  symbol  )  throw () [inline]

Look up a symbol within the loadable object.

Parameters:
symbol The symbol to look up.
Returns:
A pointer to the symbol, or NULL if the symbol was not found, or if the file is not open.
void setPath ( const String path  )  throw () [inline]

Set the object file path.

If the object file is open, the call has no effect.


The documentation for this class was generated from the following files:
Generated on Fri Sep 3 23:49:36 2010 for libcommonc++ by  doxygen 1.6.3