summaryrefslogtreecommitdiff
path: root/ace/DLL.h
diff options
context:
space:
mode:
Diffstat (limited to 'ace/DLL.h')
-rw-r--r--ace/DLL.h44
1 files changed, 27 insertions, 17 deletions
diff --git a/ace/DLL.h b/ace/DLL.h
index 63772cdf268..77db56e6f88 100644
--- a/ace/DLL.h
+++ b/ace/DLL.h
@@ -21,6 +21,8 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+class ACE_DLL_Handle;
+
/**
* @class ACE_DLL
*
@@ -55,6 +57,9 @@ public:
int open_mode = ACE_DEFAULT_SHLIB_MODE,
int close_on_destruction = 1);
+ /// Copy constructor.
+ ACE_DLL (const ACE_DLL &);
+
/**
* This method opens and dynamically links <dll_name>. The default
* mode is <RTLD_LAZY>, which loads identifier symbols but not the
@@ -83,44 +88,49 @@ public:
/// the <symbol_name> is returned. Otherwise, returns 0.
void *symbol (const ACE_TCHAR *symbol_name);
- /// Returns a pointer to a string explaining why <symbol> or <open>
- /// failed.
+ /// 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_TCHAR *error (void) const;
/**
* 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.
+ * <close_on_destruction> is set.
*/
- ACE_SHLIB_HANDLE get_handle (int become_owner = 0);
+ ACE_SHLIB_HANDLE get_handle (int become_owner = 0) const;
/// Set the handle for the DLL object. By default, the <close> operation on the
/// object will be invoked before it is destroyed.
int set_handle (ACE_SHLIB_HANDLE handle, int close_on_destruction = 1);
+
private:
- /// Used internally to save the last error of a library operation so that
- /// multiple subsequent calls to error() can be made safely.
- void save_last_error (void);
- /// This is a handle to the DLL.
- ACE_SHLIB_HANDLE handle_;
+ int open_i (const ACE_TCHAR *dll_name,
+ int open_mode = ACE_DEFAULT_SHLIB_MODE,
+ int close_on_destruction = 1,
+ ACE_SHLIB_HANDLE handle = 0);
+
+
+ /// Open mode.
+ int 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.
+ ACE_TCHAR *dll_name_;
/// This flag keeps track of whether we should close the handle
/// automatically when the destructor runs.
int close_on_destruction_;
- /// 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.
- static sig_atomic_t open_called_;
+ ACE_DLL_Handle *dll_handle_;
- /// This is the last error.
- ACE_TCHAR *last_error_;
+ /// Flag to record if the last operation had an error.
+ int error_;
// = Disallow copying and assignment since we don't handle these.
- ACE_UNIMPLEMENTED_FUNC (ACE_DLL (const ACE_DLL &))
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_DLL &))
};