module Class Reference
[DL Library]

#include <unixstl/dl/module.hpp>

List of all members.


Detailed Description

Class for manipulating dynamically loaded libraries.

Public Types

typedef void * module_handle_type
 The handle type.
typedef module class_type
 The class type.
typedef void * proc_pointer_type
 The entry point type.

Public Member Functions

Construction
 module (char const *moduleName, int mode=RTLD_NOW)
 Constructs by loading the named module.
 module (wchar_t const *moduleName, int mode=RTLD_NOW)
 Constructs by loading the named module.
template<typename S>
 module (S const &moduleName, int mode=RTLD_NOW)
 Constructs by loading the named module.
 module (module_handle_type hmodule)
 Constructs by taking ownership of the given handle.
 ~module () throw ()
 Closes the module handle.
Operations
void unload ()
 Closes the module handle.
module_handle_type detach ()
 Yields the module handle to the caller.
Lookup Operations
proc_pointer_type get_symbol (char const *symbolName)
 Looks up the named symbol.
template<typename F>
proc_pointer_type get_symbol (char const *symbolName, F &f)
 Looks up a named symbol into a typed function pointer variable.
Accessors
module_handle_type get_module_handle () const
 Provides access to the underlying module handle.

Static Public Member Functions

Static operations
static module_handle_type load (char const *moduleName, int mode=RTLD_NOW)
 Loads the named module, returning its handle, which the caller must close with unload().
static module_handle_type load (wchar_t const *moduleName, int mode=RTLD_NOW)
 Loads the named module, returning its handle, which the caller must close with unload().
template<typename S>
static module_handle_type load (S const &moduleName, int mode=RTLD_NOW)
 Loads the named module, returning its handle, which the caller must close with unload().
static void unload (module_handle_type hmodule)
 Closes the given module handle.
static proc_pointer_type get_symbol (module_handle_type hmodule, char const *symbolName)
 Looks up the named symbol from the given module.
template<typename F>
static proc_pointer_type get_symbol (module_handle_type hmodule, char const *symbolName, F &f)
 Looks up a named symbol from the given module into a typed function pointer variable.

Member Typedef Documentation

typedef void* module_handle_type

The handle type.

typedef module class_type

The class type.

typedef void* proc_pointer_type

The entry point type.


Constructor & Destructor Documentation

module ( char const *  moduleName,
int  mode = RTLD_NOW 
) [explicit]

Constructs by loading the named module.

Parameters:
moduleName The file name of the executable module to be loaded.
mode The loading mode (as used by dlopen()).
Note:
If exception-handling is being used, then this throws a unix_exception if the module cannot be loaded

module ( wchar_t const *  moduleName,
int  mode = RTLD_NOW 
) [explicit]

Constructs by loading the named module.

Parameters:
moduleName The file name of the executable module to be loaded.
mode The loading mode (as used by dlopen()).
Note:
If exception-handling is being used, then this throws a unix_exception if the module cannot be loaded

module ( S const &  moduleName,
int  mode = RTLD_NOW 
) [inline, explicit]

Constructs by loading the named module.

Parameters:
moduleName The file name of the executable module to be loaded. The argument may be of any type for which the string access shim stlsoft::c_str_ptr is defined.
mode The loading mode (as used by dlopen()).
Note:
If exception-handling is being used, then this throws a unix_exception if the module cannot be loaded

module ( module_handle_type  hmodule  )  [explicit]

Constructs by taking ownership of the given handle.

Note:
If exception-handling is being used, then this throws a unix_exception if the handle is NULL.

~module (  )  throw ()

Closes the module handle.


Member Function Documentation

static module_handle_type load ( char const *  moduleName,
int  mode = RTLD_NOW 
) [static]

Loads the named module, returning its handle, which the caller must close with unload().

Parameters:
moduleName The file name of the executable module to be loaded.
mode The loading mode (as used by dlopen()).
Returns:
The module handle, or NULL if no matching module found.

static module_handle_type load ( wchar_t const *  moduleName,
int  mode = RTLD_NOW 
) [static]

Loads the named module, returning its handle, which the caller must close with unload().

Parameters:
moduleName The file name of the executable module to be loaded.
mode The loading mode (as used by dlopen()).
Returns:
The module handle, or NULL if no matching module found.

static module_handle_type load ( S const &  moduleName,
int  mode = RTLD_NOW 
) [inline, static]

Loads the named module, returning its handle, which the caller must close with unload().

Parameters:
moduleName The file name of the executable module to be loaded. The argument may be of any type for which the string access shim stlsoft::c_str_ptr is defined.
mode The loading mode (as used by dlopen()).
Returns:
The module handle, or NULL if no matching module found.

References unixstl::c_str_ptr(), and stlsoft_ns_qual.

static void unload ( module_handle_type  hmodule  )  [static]

Closes the given module handle.

static proc_pointer_type get_symbol ( module_handle_type  hmodule,
char const *  symbolName 
) [static]

Looks up the named symbol from the given module.

Returns:
A pointer to the named symbol, or NULL if not found

static proc_pointer_type get_symbol ( module_handle_type  hmodule,
char const *  symbolName,
F &  f 
) [inline, static]

Looks up a named symbol from the given module into a typed function pointer variable.

Returns:
A pointer to the named symbol, or NULL if not found.

void unload (  ) 

Closes the module handle.

module_handle_type detach (  ) 

Yields the module handle to the caller.

proc_pointer_type get_symbol ( char const *  symbolName  ) 

Looks up the named symbol.

Returns:
A pointer to the named symbol, or NULL if not found

proc_pointer_type get_symbol ( char const *  symbolName,
F &  f 
) [inline]

Looks up a named symbol into a typed function pointer variable.

Returns:
A pointer to the named symbol, or NULL if not found.

module_handle_type get_module_handle (  )  const

Provides access to the underlying module handle.

Referenced by unixstl::get_module_handle().


The documentation for this class was generated from the following file:

Generated on Thu Jun 10 08:59:06 2010 for STLSoft by  doxygen 1.5.6