module Class Reference
[DL Library]

#include <winstl/dl/module.hpp>

List of all members.


Detailed Description

Class for manipulating dynamically loaded libraries.

Public Types

typedef HINSTANCE module_handle_type
 The handle type.
typedef HINSTANCE handle_type
 The handle type.
typedef module class_type
 The class type.
typedef void(* proc_pointer_type )()
 The entry point type.
typedef handle_type resource_type

Public Member Functions

Construction
 module (char const *moduleName)
 Constructs by loading the named module.
 module (wchar_t const *moduleName)
 Constructs by loading the named module.
template<typename S>
 module (S const &moduleName)
 Constructs by loading the named module.
 module (module_handle_type hmodule)
 Constructs by taking ownership of the given handle.
 module (class_type const &rhs)
 Copy constructor.
 ~module () throw ()
 Closes the module handle.
Operations
void unload () throw ()
 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 a named symbol.
proc_pointer_type get_symbol (ws_uint32_t symbolOrdinal)
 Looks up a symbol by ordinal.
template<typename F>
proc_pointer_type get_symbol (char const *symbolName, F &f)
 Looks up a named symbol into a typed function pointer variable.
template<typename F>
proc_pointer_type get_symbol (ws_uint32_t symbolOrdinal, F &f)
 Looks up a symbol by ordinal into a typed function pointer variable.
Accessors
module_handle_type get_module_handle () const
 Provides access to the underlying module handle.
module_handle_type get () const
 Provides access to the underlying module handle.

Static Public Member Functions

Static operations
static module_handle_type load (char const *moduleName)
 Loads the named module, returning its handle, which the caller must close with unload().
static module_handle_type load (wchar_t const *moduleName)
 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)
 Loads the named module, returning its handle, which the caller must close with unload().
static void unload (module_handle_type hmodule) throw ()
 Closes the given module handle.
static proc_pointer_type get_symbol (module_handle_type hmodule, char const *symbolName)
 Looks up a named symbol from the given module.
static proc_pointer_type get_symbol (module_handle_type hmodule, ws_uint32_t symbolOrdinal)
 Looks up a symbol by ordinal 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.
template<typename F>
static proc_pointer_type get_symbol (module_handle_type hmodule, ws_uint32_t symbolOrdinal, F &f)
 Looks up a symbol by ordinal from the given module into a typed function pointer variable.

Member Typedef Documentation

typedef HINSTANCE module_handle_type

The handle type.

typedef HINSTANCE handle_type

The handle type.

Note:
This member type is required to make it compatible with the STLSoft get_module_handle access shim

typedef module class_type

The class type.

typedef void(* proc_pointer_type)()

The entry point type.


Constructor & Destructor Documentation

module ( char const *  moduleName  )  [explicit]

Constructs by loading the named module.

Parameters:
moduleName The file name of the executable module to be loaded.
Note:
If exception-handling is being used, then this throws a windows_exception if the module cannot be loaded

module ( wchar_t const *  moduleName  )  [explicit]

Constructs by loading the named module.

Parameters:
moduleName The file name of the executable module to be loaded.
Note:
If exception-handling is being used, then this throws a windows_exception if the module cannot be loaded

module ( S const &  moduleName  )  [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.
Note:
If exception-handling is being used, then this throws a windows_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 windows_exception if the handle is NULL.

module ( class_type const &  rhs  ) 

Copy constructor.

Note:
Both copies hold independent handles to the underlying module.

~module (  )  throw ()

Closes the module handle.


Member Function Documentation

static module_handle_type load ( char const *  moduleName  )  [static]

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

Returns:
The module handle, or NULL if no matching module found.

static module_handle_type load ( wchar_t const *  moduleName  )  [static]

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

Returns:
The module handle, or NULL if no matching module found.

static module_handle_type load ( S const &  moduleName  )  [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.
Returns:
The module handle, or NULL if no matching module found.

References stlsoft_ns_qual.

static void unload ( module_handle_type  hmodule  )  throw () [static]

Closes the given module handle.

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

Looks up a 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,
ws_uint32_t  symbolOrdinal 
) [static]

Looks up a symbol by ordinal 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.

static proc_pointer_type get_symbol ( module_handle_type  hmodule,
ws_uint32_t  symbolOrdinal,
F &  f 
) [inline, static]

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

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

void unload (  )  throw ()

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 a named symbol.

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

proc_pointer_type get_symbol ( ws_uint32_t  symbolOrdinal  ) 

Looks up a symbol by ordinal.

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.

proc_pointer_type get_symbol ( ws_uint32_t  symbolOrdinal,
F &  f 
) [inline]

Looks up a symbol by ordinal 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 winstl::get_module_handle().

module_handle_type get (  )  const

Provides access to the underlying module handle.


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

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