diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-12-08 05:18:39 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-12-08 05:18:39 +0000 |
commit | cd289f365b81f0ee568516d1208aec6e119ee146 (patch) | |
tree | e04a492d5355ecc4d6a0b28540097c3bc0afc3a6 /ace/DLL.cpp | |
parent | a5b45c68550f87afa62f1ef0a6caef2f8e67469b (diff) | |
download | ATCD-cd289f365b81f0ee568516d1208aec6e119ee146.tar.gz |
*** empty log message ***
Diffstat (limited to 'ace/DLL.cpp')
-rw-r--r-- | ace/DLL.cpp | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/ace/DLL.cpp b/ace/DLL.cpp index 5ba8b1553dc..961b3e1cafd 100644 --- a/ace/DLL.cpp +++ b/ace/DLL.cpp @@ -37,9 +37,7 @@ ACE_DLL::ACE_DLL (ACE_DL_TYPE dll_name, ACE_DLL::~ACE_DLL (void) { // CLose the library only if it hasn't been already. - if (this->close_on_destruction_ != 0 - && this->handle_ != ACE_SHLIB_INVALID_HANDLE) - this->close (); + this->close (); } // This method opens the library based on the mode specified using the @@ -54,7 +52,7 @@ ACE_DLL::~ACE_DLL (void) // relocation processing of any other object. int -ACE_DLL::open (ACE_DL_TYPE dll_name, +ACE_DLL::open (ACE_DL_TYPE dll_filename, int open_mode, int close_on_destruction) { @@ -62,10 +60,23 @@ ACE_DLL::open (ACE_DL_TYPE dll_name, // once without closing it which would cause handle memory leaks. this->close (); + // Reset the flag this->close_on_destruction_ = close_on_destruction; + // Find out where the library is + ASYS_TCHAR dll_pathname[MAXPATHLEN + 1]; + + // Transform the pathname into the appropriate dynamic link library + // by searching the ACE_LD_SEARCH_PATH. + int result = ACE::ldfind (ASYS_WIDE_STRING (dll_filename), + dll_pathname, + (sizeof dll_pathname / sizeof (ASYS_TCHAR))); + // Check for errors + if (result != 0) + return result; + // The ACE_SHLIB_HANDLE object is obtained. - this->handle_ = ACE_OS::dlopen (dll_name, open_mode); + this->handle_ = ACE_OS::dlopen (dll_pathname, open_mode); if (this->handle_ == ACE_SHLIB_INVALID_HANDLE) ACE_ERROR_RETURN ((LM_ERROR, @@ -88,17 +99,20 @@ ACE_DLL::symbol (ACE_DL_TYPE sym_name) int ACE_DLL::close (void) { + int retval = 0; + // The handle is checked to see whether the library is closed - // already. If not, it is closed and the handle is made invalid to - // indicate that it's now closed. - if (this->handle_ != ACE_SHLIB_INVALID_HANDLE) + // already and the <close_on_destruction_> flag is specified. If + // not, it is closed and the handle is made invalid to indicate that + // it's now closed. + if (this->close_on_destruction_ != 0 && + this->handle_ != ACE_SHLIB_INVALID_HANDLE) { - int retval = ACE_OS::dlclose (this->handle_); - this->handle_ = ACE_SHLIB_INVALID_HANDLE; - return retval; + retval = ACE_OS::dlclose (this->handle_); } - else - return 0; + + this->handle_ = ACE_SHLIB_INVALID_HANDLE; + return retval; } // This method is used on error in an library operation. |