Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_DLL Class Reference

Provides an abstract interface for handling various DLL operations. More...

#include <DLL.h>

List of all members.

Public Methods

 ACE_DLL (int close_on_destruction=1)
 Default constructor. By default, the <close> operation on the object will be invoked before it is destroyed. More...

 ACE_DLL (const ACE_TCHAR *dll_name, int open_mode=ACE_DEFAULT_SHLIB_MODE, int close_on_destruction=1)
 This constructor opens and dynamically links. More...

int open (const ACE_TCHAR *dll_name, int open_mode=ACE_DEFAULT_SHLIB_MODE, int close_on_destruction=1)
 This method opens and dynamically links. More...

int close (void)
 Call to close the DLL object. More...

 ~ACE_DLL (void)
 Called when the DLL object is destroyed -- invokes <close> if the <close_on_destruction> flag is set in the constructor or <open> method. More...

void * symbol (const ACE_TCHAR *symbol_name)
 If <symbol_name> is in the symbol table of the DLL a pointer to the <symbol_name> is returned. Otherwise, returns 0. More...

ACE_TCHARerror (void) const
 Returns a pointer to a string explaining why <symbol> or <open> failed. More...

ACE_SHLIB_HANDLE get_handle (int become_owner=0)
 Return the handle to the caller. More...

int set_handle (ACE_SHLIB_HANDLE handle, int close_on_destruction=1)
 Set the handle for the DLL object. By default, the <close> operation on the object will be invoked before it is destroyed. More...


Private Methods

void save_last_error (void)
 Used internally to save the last error of a library operation so that multiple subsequent calls to error() can be made safely. More...

 ACE_DLL (const ACE_DLL &)
void operator= (const ACE_DLL &)

Private Attributes

ACE_SHLIB_HANDLE handle_
 This is a handle to the DLL. More...

int close_on_destruction_
 This flag keeps track of whether we should close the handle automatically when the destructor runs. More...

ACE_TCHARlast_error_
 This is the last error. More...


Static Private Attributes

sig_atomic_t open_called_ = 0
 This flag keeps track of whether the open method has ever been called on any ACE_DLL object. Used by error() to decide whether or not to call ACE_OS::dlerror(). On Linux, at least, calls to dlerror() prior to calling dlopen() causes a seg-fault. More...


Detailed Description

Provides an abstract interface for handling various DLL operations.

This class is an wrapper over the various methods for utilizing a dynamically linked library (DLL), which is called a shared library on some platforms. Operations <open>, <close>, and <symbol> have been implemented to help opening/closing and extracting symbol information from a DLL, respectively.


Constructor & Destructor Documentation

ACE_DLL::ACE_DLL int    close_on_destruction = 1
 

Default constructor. By default, the <close> operation on the object will be invoked before it is destroyed.

ACE_DLL::ACE_DLL const ACE_TCHAR   dll_name,
int    open_mode = ACE_DEFAULT_SHLIB_MODE,
int    close_on_destruction = 1
 

This constructor opens and dynamically links.

<dll_name>. The default mode is <RTLD_LAZY>, which loads identifier symbols but not the symbols for functions, which are loaded dynamically on-demand. Other supported modes include: <RTLD_NOW>, which performs all necessary relocations when <dll_name> is first loaded and <RTLD_GLOBAL>, which makes symbols available for relocation processing of any other DLLs.

ACE_DLL::~ACE_DLL void   
 

Called when the DLL object is destroyed -- invokes <close> if the <close_on_destruction> flag is set in the constructor or <open> method.

ACE_DLL::ACE_DLL const ACE_DLL &    [private]
 


Member Function Documentation

int ACE_DLL::close void   
 

Call to close the DLL object.

ACE_TCHAR * ACE_DLL::error void    const
 

Returns a pointer to a string explaining why <symbol> or <open> failed.

ACE_SHLIB_HANDLE ACE_DLL::get_handle int    become_owner = 0
 

Return the handle to the caller.

If <become_owner> is non-0 then caller assumes ownership of the handle and the <ACE_DLL> object won't call <close> when it goes out of scope, even if <close_on_destruction> is set.

int ACE_DLL::open const ACE_TCHAR   dll_filename,
int    open_mode = ACE_DEFAULT_SHLIB_MODE,
int    close_on_destruction = 1
 

This method opens and dynamically links.

<dll_name>. The default mode is <RTLD_LAZY>, which loads identifier symbols but not the symbols for functions, which are loaded dynamically on-demand. Other supported modes include: <RTLD_NOW>, which performs all necessary relocations when <dll_name> is first loaded and <RTLD_GLOBAL>, which makes symbols available for relocation processing of any other DLLs. Returns -1 on failure and 0 on success.

void ACE_DLL::operator= const ACE_DLL &    [private]
 

void ACE_DLL::save_last_error void    [private]
 

Used internally to save the last error of a library operation so that multiple subsequent calls to error() can be made safely.

int ACE_DLL::set_handle ACE_SHLIB_HANDLE    handle,
int    close_on_destruction = 1
 

Set the handle for the DLL object. By default, the <close> operation on the object will be invoked before it is destroyed.

void * ACE_DLL::symbol const ACE_TCHAR   sym_name
 

If <symbol_name> is in the symbol table of the DLL a pointer to the <symbol_name> is returned. Otherwise, returns 0.


Member Data Documentation

int ACE_DLL::close_on_destruction_ [private]
 

This flag keeps track of whether we should close the handle automatically when the destructor runs.

ACE_SHLIB_HANDLE ACE_DLL::handle_ [private]
 

This is a handle to the DLL.

ACE_TCHAR* ACE_DLL::last_error_ [private]
 

This is the last error.

sig_atomic_t ACE_DLL::open_called_ = 0 [static, private]
 

This flag keeps track of whether the open method has ever been called on any ACE_DLL object. Used by error() to decide whether or not to call ACE_OS::dlerror(). On Linux, at least, calls to dlerror() prior to calling dlopen() causes a seg-fault.


The documentation for this class was generated from the following files:
Generated on Thu May 23 00:16:53 2002 for ACE by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001