![]() |
Home | Libraries | People | FAQ | More |
boost::extensions::shared_library — A wrapper around OS-specific shared library functions.
class shared_library { public: // construct/copy/destruct shared_library(const std::string &, bool = false); ~shared_library(); // public member functions bool is_open() const; bool open() ; bool close() ; template<typename TypeInfo> bool call(basic_type_map< TypeInfo > &) ; template<typename RetValue, typename Params...> FunctionPtr< ReturnValue(Params...)> get(const std::string &) const; };
shared_library
public
construct/copy/destructshared_library(const std::string & location, bool auto_close = false);
shared_library constructor
| Parameters: |
|
~shared_library();
shared_library destructor If auto_close_ was set to true in the constructor, this closes the library if it is currently open.
shared_library public member functionsbool is_open() const;
| Requires: | None. |
| Postconditions: | None. |
| Returns: | true if the shared library is currently open and referenced by this object. |
bool open() ;
| Requires: | None. |
| Postconditions: | If true is returned, the shared library is opened and get() can be called. |
| Returns: | true if the shared library was opened successfully. |
bool close() ;
| Requires: | is_open() == true. |
| Postconditions: | is_open() == false. |
| Returns: | true if the close function was successful. |
template<typename TypeInfo> bool call(basic_type_map< TypeInfo > & types) ;
There is a special function called boost_extension_exported_type_map_function which is commonly used by shared libraries. The call function attempts to find and call that function, given a type_map.
| Parameters: |
|
||
| Requires: | is_open() == true |
||
| Postconditions: | None. |
||
| Returns: | true on success. |
template<typename RetValue, typename Params...> FunctionPtr< ReturnValue(Params...)> get(const std::string & name) const;
A templated function taking as template arguments the type of the return value and parameters of a function to look up in the shared library.
This function must have been declared with the same parameters and return type and marked as extern "C".
Depending on platform and compiler settings, it may also be necessary to prefix the function with BOOST_EXTENSION_DECL, to make it externally visible.
If the function signature does not match, strange errors can occur.
| Requires: | is_open() == true. |
| Postconditions: | None. |