Home | Libraries | People | FAQ | More |
boost::dll::experimental::import_class
// In header: <boost/dll/import_class.hpp> template<typename T, typename... Args> imported_class< T > import_class(const smart_library & lib, std::size_t size, Args... args); template<typename T, typename... Args> imported_class< T > import_class(const smart_library & lib, std::size_t size, const std::string & alias_name, Args... args); template<typename T, typename... Args> imported_class< T > import_class(const smart_library & lib_, const std::string & alias_name, std::size_t size, Args... args); template<typename T, typename... Args> imported_class< T > import_class(smart_library && lib, Args... args); template<typename T, typename... Args> imported_class< T > import_class(smart_library && lib, const std::string & alias_name, Args... args); template<typename T, typename... Args> imported_class< T > import_class(smart_library && lib, std::size_t size, Args... args); template<typename T, typename... Args> imported_class< T > import_class(smart_library && lib, std::size_t size, const std::string & alias_name, Args... args); template<typename T, typename... Args> imported_class< T > import_class(smart_library && lib, const std::string & alias_name, std::size_t size, Args... args);
Returns an instance of imported_class
which allows to call or import more functions. It takes a copy of the smart_libray, so no added type_aliases will be visible, for the object.
Few compilers do implement an allocating constructor, which allows the construction of the class without knowing the size. That is not portable, so the actual size of the class shall always be provided.
Example:
auto import_class<class type_alias, const std::string&, std::size_t>(lib, "class_name", 20, "param1", 42);
In this example we construct an instance of the class "class_name" with the size 20, which has "type_alias" as an alias, through a constructor which takes a const-ref of std::string and an std::size_t parameter.
Note | |
---|---|
This function does add the type alias to the boost::dll::experimental::smart_library. |
Parameters: |
|
||
Returns: |
class object. |
||
Throws: |
boost::system::system_error if symbol does not exist or if the DLL/DSO was not loaded. Overload that accepts path also throws std::bad_alloc in case of insufficient memory. |