#include <DLL.h>
Public Member Functions | |
ACE_DLL (bool close_handle_on_destruction=true) | |
ACE_DLL & | operator= (const ACE_DLL &rhs) |
Allow assignment. | |
ACE_DLL (const ACE_TCHAR *dll_name, int open_mode=ACE_DEFAULT_SHLIB_MODE, bool close_handle_on_destruction=true) | |
ACE_DLL (const ACE_DLL &) | |
Copy constructor. | |
int | open (const ACE_TCHAR *dll_name, int open_mode=ACE_DEFAULT_SHLIB_MODE, bool close_handle_on_destruction=true) |
int | close (void) |
Call to close the DLL object. | |
~ACE_DLL (void) | |
void * | symbol (const ACE_TCHAR *symbol_name, int ignore_errors=0) |
ACE_TCHAR * | error (void) const |
ACE_SHLIB_HANDLE | get_handle (int become_owner=0) const |
int | set_handle (ACE_SHLIB_HANDLE handle, bool close_handle_on_destruction=true) |
Set the handle for the DLL object. By default, the close(). | |
Public Attributes | |
int | open_mode_ |
Open mode. | |
ACE_TCHAR * | dll_name_ |
bool | close_handle_on_destruction_ |
ACE_DLL_Handle * | dll_handle_ |
bool | error_ |
Flag to record if the last operation had an error. | |
Private Member Functions | |
int | open_i (const ACE_TCHAR *dll_name, int open_mode=ACE_DEFAULT_SHLIB_MODE, bool close_handle_on_destruction=true, ACE_SHLIB_HANDLE handle=0) |
This class is a 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.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_DLL::ACE_DLL | ( | bool | close_handle_on_destruction = true |
) | [explicit] |
Default constructor. By default, the close() operation on the object will be invoked before it is destroyed.
close_handle_on_destruction | Indicates whether or not the close() method will be called to close an open DLL when this object is destroyed. By default, close() will be called. Set this parameter to 0 for situations where the DLL's lifetime is controlled in a scope other than that of this ACE_DLL object. For example, termination by ACE_DLL_Manager via ACE::fini(). |
ACE_DLL::ACE_DLL | ( | const ACE_TCHAR * | dll_name, | |
int | open_mode = ACE_DEFAULT_SHLIB_MODE , |
|||
bool | close_handle_on_destruction = true | |||
) | [explicit] |
This constructor performs the actions of open() during construction.
dll_name | The name or path of the DLL to load. | |
open_mode | Flags to alter the actions taken when loading the DLL. The possible values are:
| |
close_handle_on_destruction | Indicates whether or not the close() method will be called to close an open DLL when this object is destroyed. By default, close() will be called. Set this parameter to 0 for situations where the DLL's lifetime is controlled in a scope other than that of this ACE_DLL object. For example, termination by ACE_DLL_Manager via ACE::fini(). |
ACE_DLL::ACE_DLL | ( | const ACE_DLL & | rhs | ) |
Copy constructor.
ACE_DLL::~ACE_DLL | ( | void | ) |
int ACE_DLL::open | ( | const ACE_TCHAR * | dll_name, | |
int | open_mode = ACE_DEFAULT_SHLIB_MODE , |
|||
bool | close_handle_on_destruction = true | |||
) |
This method opens and dynamically links a specified DLL.
dll_name | The filename or path of the DLL to load. If a filename is given to open() , the ACE::ldfind() is used to locate DLLs via the following algorithms: (1) DLL filename expansion: ACE::ldfind() determines the name of the DLL by adding the appropriate prefix and suffix, e.g., it adds the lib prefix and .so suffix for Solaris and the .dll suffix for Windows and (2) DLL search path: ACE::ldfind() will also search for the designated DLL using the platform's DLL search path environment variable, e.g., it searches for DLLs using LD_LIBRARY_PATH on many UNIX systems and PATH on Windows. | |
open_mode | Flags to alter the actions taken when loading the DLL. The possible values are:
| |
close_handle_on_destruction | Indicates whether or not the close() method will be called to close an open DLL when this object is destroyed. By default, close() will be called. Set this parameter to 0 for situations where the DLL's lifetime is controlled in a scope other than that of this ACE_DLL object. For example, termination by ACE_DLL_Manager via ACE::fini(). |
-1 | On failure | |
0 | On success. |
int ACE_DLL::close | ( | void | ) |
Call to close the DLL object.
void * ACE_DLL::symbol | ( | const ACE_TCHAR * | symbol_name, | |
int | ignore_errors = 0 | |||
) |
Look up a named symbol in the DLL. DLL must be successfully opened before calling symbol().
symbol_name | The symbol name to look up. | |
ignore_errors | If set to 1, allows you to probe a dll without generating error messages in the log. Handy for determining the capabilities of a library. |
ACE_TCHAR * ACE_DLL::error | ( | void | ) | const |
Returns a pointer to a string explaining that an error occured. You will need to consult the error log for the actual error string returned by the OS.
ACE_SHLIB_HANDLE ACE_DLL::get_handle | ( | int | become_owner = 0 |
) | const |
int ACE_DLL::set_handle | ( | ACE_SHLIB_HANDLE | handle, | |
bool | close_handle_on_destruction = true | |||
) |
Set the handle for the DLL object. By default, the close().
int ACE_DLL::open_i | ( | const ACE_TCHAR * | dll_name, | |
int | open_mode = ACE_DEFAULT_SHLIB_MODE , |
|||
bool | close_handle_on_destruction = true , |
|||
ACE_SHLIB_HANDLE | handle = 0 | |||
) | [private] |
Open mode.
Keep track of the name of the loaded dll, so it can be used to remove framework components, singletons that live in the dll, prior to unloading the dll in the close() method.
This flag keeps track of whether we should close the handle automatically when the object is destroyed.
bool ACE_DLL::error_ |
Flag to record if the last operation had an error.