From af6bb5013ce848c94e1d0711a6ef99af8a4a55a2 Mon Sep 17 00:00:00 2001
From: TizenOpenSource boost::dll::experimental::smart_library — This class is an extension of shared_library, which allows to load C++ symbols. This class allows type safe loading of overloaded functions, member-functions, constructors and variables. It also allows to overwrite classes so they can be loaded, while being declared with different names. This does however not happen when the value is set inside the constructor function. Creates in anstance that does not reference any DLL/DSO.
- Loads a library by specified path with a specified mode.
- Library file name. Can handle std::string, const char*, std::wstring, const wchar_t* or boost::dll::fs::path. Library file name. Can handle std::string, const char*, std::wstring, const wchar_t* or boost::dll::fs::path. Loads a library by specified path with a specified mode.
- Library file name. Can handle std::string, const char*, std::wstring, const wchar_t* or boost::dll::fs::path. Library file name. Can handle std::string, const char*, std::wstring, const wchar_t* or boost::dll::fs::path. Throws: This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. copy a
@@ -254,7 +252,7 @@ Currently known limitations: Move a
@@ -286,7 +284,7 @@ Currently known limitations: Construct from a
@@ -318,7 +316,7 @@ Currently known limitations: Construct from a
@@ -350,7 +348,7 @@ Currently known limitations: Destroys the
@@ -21,7 +22,7 @@
Class smart_library
Synopsis
-// In header: <boost/dll/smart_library.hpp>
+
Synopsis
+// In header: <boost/dll/smart_library.hpp>
class smart_library {
@@ -39,49 +40,49 @@
typedef unspecified mangled_storage;
// construct/copy/destruct
- smart_library() noexcept;
- smart_library(const boost::dll::fs::path &,
+ smart_library() noexcept;
+ smart_library(const boost::dll::fs::path &,
load_mode::type = load_mode::default_mode);
- smart_library(const boost::dll::fs::path &, boost::dll::fs::error_code &,
+ smart_library(const boost::dll::fs::path &, boost::dll::fs::error_code &,
load_mode::type = load_mode::default_mode);
- smart_library(const boost::dll::fs::path &, load_mode::type,
+ smart_library(const boost::dll::fs::path &, load_mode::type,
boost::dll::fs::error_code &);
- smart_library(const smart_library &) noexcept;
- smart_library(smart_library &&) noexcept;
- explicit smart_library(const shared_library &) noexcept;
- explicit smart_library(shared_library &&) noexcept;
- ~smart_library();
+ smart_library(const smart_library &) noexcept;
+ smart_library(smart_library &&) noexcept;
+ explicit smart_library(const shared_library &) noexcept;
+ explicit smart_library(shared_library &&) noexcept;
+ ~smart_library();
- // public member functions
- const shared_library & shared_lib() const;
- const mangled_storage & symbol_storage() const;
- mangled_storage & symbol_storage();
- void load(const boost::dll::fs::path &,
+ // public member functions
+ const shared_library & shared_lib() const;
+ const mangled_storage & symbol_storage() const;
+ mangled_storage & symbol_storage();
+ void load(const boost::dll::fs::path &,
load_mode::type = load_mode::default_mode);
- void load(const boost::dll::fs::path &, boost::dll::fs::error_code &,
+ void load(const boost::dll::fs::path &, boost::dll::fs::error_code &,
load_mode::type = load_mode::default_mode);
- void load(const boost::dll::fs::path &, load_mode::type,
+ void load(const boost::dll::fs::path &, load_mode::type,
boost::dll::fs::error_code &);
- template<typename T> T & get_variable(const std::string &) const;
- template<typename Func> Func & get_function(const std::string &) const;
+ template<typename T> T & get_variable(const std::string &) const;
+ template<typename Func> Func & get_function(const std::string &) const;
template<typename Class, typename Func>
- unspecified get_mem_fn(const std::string &) const;
+ unspecified get_mem_fn(const std::string &) const;
template<typename Signature>
- constructor< Signature > get_constructor() const;
- template<typename Class> destructor< Class > get_destructor() const;
- template<typename Class> const std::type_info & get_type_info() const;
- template<typename Alias> void add_type_alias(const std::string &);
- void unload() noexcept;
- bool is_loaded() const noexcept;
- bool operator!() const noexcept;
- explicit operator bool() const noexcept;
- bool has(const char *) const noexcept;
- bool has(const std::string &) const noexcept;
- smart_library & assign(const smart_library &);
- void swap(smart_library &) noexcept;
+ constructor< Signature > get_constructor() const;
+ template<typename Class> destructor< Class > get_destructor() const;
+ template<typename Class> const std::type_info & get_type_info() const;
+ template<typename Alias> void add_type_alias(const std::string &);
+ void unload() noexcept;
+ bool is_loaded() const noexcept;
+ bool operator!() const noexcept;
+ explicit operator bool() const noexcept;
+ bool has(const char *) const noexcept;
+ bool has(const std::string &) const noexcept;
+ smart_library & assign(const smart_library &);
+ void swap(smart_library &) noexcept;
};
Description
+Description
@@ -105,17 +106,17 @@ Currently known limitations:
+
smart_library
public
construct/copy/destruct
smart_library() noexcept;
+smart_library() noexcept;
smart_library(const boost::dll::fs::path & lib_path,
+
smart_library(const boost::dll::fs::path & lib_path,
load_mode::type mode = load_mode::default_mode);
-lib_path
+
@@ -173,13 +174,13 @@ Currently known limitations:
mode
smart_library(const boost::dll::fs::path & lib_path,
+
smart_library(const boost::dll::fs::path & lib_path,
boost::dll::fs::error_code & ec,
load_mode::type mode = load_mode::default_mode);
-lib_path
+
@@ -211,18 +212,15 @@ Currently known limitations:
mode
-std::bad_alloc in case of insufficient memory.
+std::bad_alloc in case of insufficient memory.
smart_library(const boost::dll::fs::path & lib_path, load_mode::type mode,
+ boost::dll::fs::error_code & ec);
smart_library(const boost::dll::fs::path & lib_path, load_mode::type mode,
- boost::dll::fs::error_code & ec);
-smart_library(const smart_library & lib) noexcept;
+smart_library(const smart_library & lib) noexcept;
smart_library
object.smart_library(smart_library && lib) noexcept;
+smart_library(smart_library && lib) noexcept;
smart_library
object.explicit smart_library(const shared_library & lib) noexcept;
+explicit smart_library(const shared_library & lib) noexcept;
shared_library
object.explicit smart_library(shared_library && lib) noexcept;
+explicit smart_library(shared_library && lib) noexcept;
shared_library
object.~smart_library();
+~smart_library();
smart_library
. unload()
is called if the DLL/DSO was loaded. If library was loaded multiple times by different instances of shared_library
, the actual DLL/DSO won't be unloaded until there is at least one instance of shared_library
.
smart_library
public member functionssmart_library
public member functionsconst shared_library & shared_lib() const;+
const shared_library & shared_lib() const;
Get the underlying shared_library
const mangled_storage & symbol_storage() const;+
const mangled_storage & symbol_storage() const;
Access to the mangled storage, which is created on construction.
@@ -392,15 +390,15 @@ Currently known limitations:
mangled_storage & symbol_storage();Overload, for current development.
mangled_storage & symbol_storage();Overload, for current development.
void load(const boost::dll::fs::path & lib_path, +void load(const boost::dll::fs::path & lib_path, load_mode::type mode = load_mode::default_mode);Loads a library by specified path with a specified mode.
Note that if some library is already loaded in this instance, load will call unload() and then load the new provided library.
-
+xmlonly <link linkend='boost.dll.fs.system_error'>boost::dll::fs::system_error</link>, std::bad_alloc in case of insufficient memory.
@@ -417,7 +415,7 @@ Currently known limitations: -
lib_path
+ Library file name. Can handle std::string, const char*, std::wstring, const wchar_t* or boost::dll::fs::path.
Library file name. Can handle std::string, const char*, std::wstring, const wchar_t* or boost::dll::fs::path.
@@ -434,14 +432,14 @@ Currently known limitations:
mode
void load(const boost::dll::fs::path & lib_path, +void load(const boost::dll::fs::path & lib_path, boost::dll::fs::error_code & ec, load_mode::type mode = load_mode::default_mode);Loads a library by specified path with a specified mode.
Note that if some library is already loaded in this instance, load will call unload() and then load the new provided library.
-
+This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
@@ -462,7 +460,7 @@ Currently known limitations: -
lib_path
+ Library file name. Can handle std::string, const char*, std::wstring, const wchar_t* or boost::dll::fs::path.
Library file name. Can handle std::string, const char*, std::wstring, const wchar_t* or boost::dll::fs::path.
@@ -473,18 +471,15 @@ Currently known limitations:
mode
- Throws:
std::bad_alloc in case of insufficient memory. +std::bad_alloc in case of insufficient memory.
void load(const boost::dll::fs::path & lib_path, load_mode::type mode, + boost::dll::fs::error_code & ec);
void load(const boost::dll::fs::path & lib_path, load_mode::type mode, - boost::dll::fs::error_code & ec);-
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-template<typename T> T & get_variable(const std::string & name) const;+
template<typename T> T & get_variable(const std::string & name) const;
Load a variable from the referenced library.
Unlinke shared_library::get this function will also load scoped variables, which also includes static class members.
template<typename Func> Func & get_function(const std::string & name) const;+
template<typename Func> Func & get_function(const std::string & name) const;
Load a function from the referenced library.
Example:
smart_library lib("test_lib.so"); @@ -565,7 +560,7 @@ Currently known limitations: - +xmlonly <link linkend='boost.dll.fs.system_error'>boost::dll::fs::system_error</link> if symbol does not exist or if the DLL/DSO was not loaded.
void unload() noexcept;+
void unload() noexcept;
Unloads a shared library. If library was loaded multiple times by different instances, the actual DLL/DSO won't be unloaded until there is at least one instance that references the DLL/DSO.
-
+ifile "/root/project/libs/dll/include/boost/dll/smart_library.hpp"bool is_loaded() const noexcept;+
bool is_loaded() const noexcept;
Check if an library is loaded.
-
+ifile "/root/project/libs/dll/include/boost/dll/smart_library.hpp"bool operator!() const noexcept;+
bool operator!() const noexcept;
Check if an library is not loaded.
-
+ifile "/root/project/libs/dll/include/boost/dll/smart_library.hpp"explicit operator bool() const noexcept;bool() const
bool() const
+explicit operator bool() const noexcept;bool() const
bool() const
bool has(const char * symbol_name) const noexcept;+
bool has(const char * symbol_name) const noexcept;
Search for a given symbol on loaded library. Works for all symbols, including alias names.
-
+This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.bool has(const std::string & symbol_name) const noexcept;
bool has(const std::string & symbol_name) const noexcept;-
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-smart_library & assign(const smart_library & lib);+
smart_library & assign(const smart_library & lib);
Makes *this share the same shared object as lib. If *this is loaded, then unloads it.
-
+xmlonly <link linkend='boost.dll.fs.system_error'>boost::dll::fs::system_error</link>, std::bad_alloc in case of insufficient memory.void swap(smart_library & rhs) noexcept;+
void swap(smart_library & rhs) noexcept;
Swaps two libraries. Does not invalidate existing symbols and functions loaded from libraries.
-
+ifile "/root/project/libs/dll/include/boost/dll/smart_library.hpp"