+#ifndef STLPLUS_DYNALOAD\r
+#define STLPLUS_DYNALOAD\r
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+// Author: Andy Rushton\r
+// Copyright: (c) Southampton University 1999-2004\r
+// (c) Andy Rushton 2004-2009\r
+// License: BSD License, see ../docs/license.html\r
+\r
+// A portable interface to the dynamic loader - i.e. the system for loading\r
+// dynamic libraries or shared libraries during the running of a program,\r
+// rather than by linking\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+#include "portability_fixes.hpp"\r
+#include <string>\r
+\r
+namespace stlplus\r
+{\r
+\r
+ //////////////////////////////////////////////////////////////////////////////\r
+ // dynaload class manages a dynamic loadable library and unloads it on destruction\r
+\r
+ class dynaload\r
+ {\r
+ public:\r
+\r
+ ////////////////////////////////////////////////////////////////////////////\r
+ // library management\r
+\r
+ // construct the object but do not load\r
+ dynaload(void);\r
+\r
+ // construct and load\r
+ dynaload(const std::string& library);\r
+\r
+ // destroy and unload if loaded\r
+ ~dynaload(void);\r
+\r
+ // load the library - return success or fail\r
+ bool load(const std::string& library);\r
+\r
+ // unload the library if loaded\r
+ bool unload(void);\r
+\r
+ // test whether the library is loaded\r
+ bool loaded(void) const;\r
+\r
+ ////////////////////////////////////////////////////////////////////////////\r
+ // symbol management\r
+\r
+ // test whether a function is exported by the library\r
+ bool present(const std::string& name);\r
+\r
+ // get the function as a generic pointer\r
+ void* symbol(const std::string& name);\r
+\r
+ ////////////////////////////////////////////////////////////////////////////\r
+ // error management\r
+\r
+ // enum values to indicate type of error\r
+ enum error_t {no_error, load_error, unload_error, symbol_error};\r
+\r
+ // test whether there has been an error\r
+ bool error(void) const;\r
+\r
+ // clear an error once it has been handled (or ignored)\r
+ void clear_error(void);\r
+\r
+ // get the type of the error as indicated by the enum error_t\r
+ error_t error_type(void) const;\r
+\r
+ // get the text of the error as provided by the OS\r
+ std::string error_text(void) const;\r
+\r
+ ////////////////////////////////////////////////////////////////////////////\r
+\r
+ private:\r
+ void* m_handle;\r
+ error_t m_error;\r
+ std::string m_text;\r
+ };\r
+\r
+}\r
+\r
+#endif\r