claw::dynamic_library_traits_win32 Class Reference

Microsoft Windows interface for using dynamic libraries. More...

#include <dynamic_library_traits_win32.hpp>

List of all members.

Public Types

typedef HMODULE handle
 Type of the system handle to the library.

Static Public Member Functions

static handle open (const std::string &name)
 Open a library.
static handle auto_open (const std::string &name)
 Open the current program.
static void close (handle h)
 Close a library.
template<class T >
static T get_symbol (handle h, const std::string &name)
 Get a symbol from a library.
static bool have_symbol (handle h, const std::string &name)
 Tell if a symbol is in the library.
static bool valid_handle (handle h)
 Tell if an handle is a valid library handle.

Detailed Description

Microsoft Windows interface for using dynamic libraries.

Author:
Julien Jorge

Definition at line 45 of file dynamic_library_traits_win32.hpp.


Member Typedef Documentation

Type of the system handle to the library.

Definition at line 49 of file dynamic_library_traits_win32.hpp.


Member Function Documentation

static handle claw::dynamic_library_traits_win32::auto_open ( const std::string &  name  )  [inline, static]

Open the current program.

Parameters:
name The name of the current program.
Returns:
The handle on the loaded library.

Definition at line 69 of file dynamic_library_traits_win32.hpp.

00070     {
00071       return LoadLibrary( name.c_str() );
00072     } // dynamic_library_traits_win32::auto_open()

static void claw::dynamic_library_traits_win32::close ( handle  h  )  [inline, static]

Close a library.

Parameters:
h The handle of the library to close.

Definition at line 79 of file dynamic_library_traits_win32.hpp.

00080     {
00081       FreeLibrary(h);
00082     } // dynamic_library_traits_win32::close()

template<class T >
static T claw::dynamic_library_traits_win32::get_symbol ( handle  h,
const std::string &  name 
) [inline, static]

Get a symbol from a library.

Parameters:
h Handle of the library.
name The name of the symbol to load.

Definition at line 91 of file dynamic_library_traits_win32.hpp.

00092     {
00093       /* HACK : ISO standard doesn't allow to cast from a pointer to an object
00094          to a pointer to a function. */
00095       T result;
00096       *(FARPROC*)(&result) = GetProcAddress( h, name.c_str() );
00097 
00098       return result;
00099     } // dynamic_library_traits_win32::get_symbol()

static bool claw::dynamic_library_traits_win32::have_symbol ( handle  h,
const std::string &  name 
) [inline, static]

Tell if a symbol is in the library.

Parameters:
h Handle of the library.
name The name of the symbol to find.

Definition at line 107 of file dynamic_library_traits_win32.hpp.

00108     {
00109       return GetProcAddress( h, name.c_str() ) != NULL;
00110     } // dynamic_library_traits_win32::have_symbol()

static handle claw::dynamic_library_traits_win32::open ( const std::string &  name  )  [inline, static]

Open a library.

Parameters:
name The name of the library to open.
Returns:
The handle on the loaded library.

Definition at line 58 of file dynamic_library_traits_win32.hpp.

00059     {
00060       return LoadLibrary( name.c_str() );
00061     } // dynamic_library_traits_win32::open()

static bool claw::dynamic_library_traits_win32::valid_handle ( handle  h  )  [inline, static]

Tell if an handle is a valid library handle.

Parameters:
h The handle to test.

Definition at line 117 of file dynamic_library_traits_win32.hpp.

00118     {
00119       return h != NULL;
00120     } // dynamic_library_traits_win32::valid_handle()


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

Generated on 9 Nov 2009 for CLAW Library (a C++ Library Absolutely Wonderful) by  doxygen 1.6.1