]>
Dogcows Code - chaz/yoink/blob - src/stlplus/portability/dynaload.hpp
dafaf243ee6dc66ae8cbc6e38c33671049fb8196
1 #ifndef STLPLUS_DYNALOAD
2 #define STLPLUS_DYNALOAD
3 ////////////////////////////////////////////////////////////////////////////////
5 // Author: Andy Rushton
6 // Copyright: (c) Southampton University 1999-2004
7 // (c) Andy Rushton 2004-2009
8 // License: BSD License, see ../docs/license.html
10 // A portable interface to the dynamic loader - i.e. the system for loading
11 // dynamic libraries or shared libraries during the running of a program,
12 // rather than by linking
14 ////////////////////////////////////////////////////////////////////////////////
15 #include "portability_fixes.hpp"
21 //////////////////////////////////////////////////////////////////////////////
22 // dynaload class manages a dynamic loadable library and unloads it on destruction
28 ////////////////////////////////////////////////////////////////////////////
31 // construct the object but do not load
35 dynaload(const std::string
& library
);
37 // destroy and unload if loaded
40 // load the library - return success or fail
41 bool load(const std::string
& library
);
43 // unload the library if loaded
46 // test whether the library is loaded
47 bool loaded(void) const;
49 ////////////////////////////////////////////////////////////////////////////
52 // test whether a function is exported by the library
53 bool present(const std::string
& name
);
55 // get the function as a generic pointer
56 void* symbol(const std::string
& name
);
58 ////////////////////////////////////////////////////////////////////////////
61 // enum values to indicate type of error
62 enum error_t
{no_error
, load_error
, unload_error
, symbol_error
};
64 // test whether there has been an error
65 bool error(void) const;
67 // clear an error once it has been handled (or ignored)
68 void clear_error(void);
70 // get the type of the error as indicated by the enum error_t
71 error_t
error_type(void) const;
73 // get the text of the error as provided by the OS
74 std::string
error_text(void) const;
76 ////////////////////////////////////////////////////////////////////////////
This page took 0.035149 seconds and 4 git commands to generate.