Class that allows loading dynamic libraries: shared objects and dlls.
More...
#include <booster/booster/shared_object.h>
|
static std::string | name (std::string const &module) |
|
static std::string | name (std::string const &module, std::string const &soversion) |
|
|
static const int | load_lazy = 1 |
|
static const int | load_now = 2 |
| Pass RTLD_LAZY to dlopen.
|
|
static const int | load_global = 4 |
| Pass RTLD_NOW to dlopen.
|
|
static const int | load_local = 8 |
| Pass RTLD_GLOBAL to dlopen.
|
|
Class that allows loading dynamic libraries: shared objects and dlls.
booster::shared_object::shared_object |
( |
| ) |
|
Pass RTLD_LOCAL to dlopen Create an empty shared object
booster::shared_object::~shared_object |
( |
| ) |
|
If the shared object was open unloads it, If private copy of DLL was made it is removed from the file system
booster::shared_object::shared_object |
( |
std::string const & |
file_name, |
|
|
int |
flags |
|
) |
| |
Create shared object and load it,
- See also
- open(std::string const&,bool);
- Parameters
-
file_name | - the name of the file, UTF-8 encoded under Windows flags - load flags: one of load_lazy, load_now, load_local, load_global - ignored on Windows |
- Exceptions
-
booster::shared_object::shared_object |
( |
std::string const & |
file_name | ) |
|
Create shared object and load it,
- See also
- open(std::string const&,bool);
- Parameters
-
file_name | - the name of the file, UTF-8 encoded under Windows |
- Exceptions
-
void booster::shared_object::close |
( |
| ) |
|
bool booster::shared_object::is_open |
( |
| ) |
const |
Check if the shared object was loaded
static std::string booster::shared_object::name |
( |
std::string const & |
module | ) |
|
|
static |
Format the OS specific name name of the library according to its name. Uses CMake convensions.
For example library "foo" is converted to the name
- libfoo.so under Linux, FreeBSD, Solaris
- libfoo.dylib under Darwin/Mac OS X
- libfoo.dll under Windows using gcc/mingw
- foo.dll under Windows using MSVC
- cygfoo.dll under Cygwin
static std::string booster::shared_object::name |
( |
std::string const & |
module, |
|
|
std::string const & |
soversion |
|
) |
| |
|
static |
Format the OS specific name name of the library according to its name and its soversion. Uses CMake convensions.
For example library "foo" and soversion "1" is converted to the name
- libfoo.so.1 under Linux, FreeBSD, Solaris
- libfoo.1.dylib under Darwin/Mac OS X
- libfoo-1.dll under Windows using gcc/mingw
- foo-1.dll under Windows using MSVC
- cygfoo-1.dll under Cygwin
bool booster::shared_object::open |
( |
std::string const & |
file_name | ) |
|
Load shared object or dll
- Parameters
-
file_name | - the name of the file, UTF-8 encoded under Windows |
- Returns
- true if the shared object was loaded
bool booster::shared_object::open |
( |
std::string const & |
file_name, |
|
|
std::string & |
error_message |
|
) |
| |
Load shared object or dll
- Parameters
-
file_name | - the name of the file, UTF-8 encoded under Windows |
error_message | - the error message |
- Returns
- true if the shared object was loaded
bool booster::shared_object::open |
( |
std::string const & |
file_name, |
|
|
int |
flags |
|
) |
| |
Load shared object or dll
- Parameters
-
file_name | - the name of the file, UTF-8 encoded under Windows flags - load flags: one of load_lazy, load_now, load_local, load_global - ignored on Windows |
- Returns
- true if the shared object was loaded
New in CppCMS 1.2
bool booster::shared_object::open |
( |
std::string const & |
file_name, |
|
|
std::string & |
error_message, |
|
|
int |
flags |
|
) |
| |
Load shared object or dll
- Parameters
-
file_name | - the name of the file, UTF-8 encoded under Windows flags - load flags: one of load_lazy, load_now, load_local, load_global - ignored on Windows |
error_message | - the error message |
- Returns
- true if the shared object was loaded
New in CppCMS 1.2
void* booster::shared_object::resolve_symbol |
( |
std::string const & |
name | ) |
const |
Resolve symbol in the shared object dll. If it can't be resolved, NULL is returned
If the shared object was not opened, it would throw booster::runtime_error
template<typename T >
void booster::shared_object::symbol |
( |
T & |
s, |
|
|
std::string const & |
name |
|
) |
| const |
|
inline |
The documentation for this class was generated from the following file: