# Shared Library Refcountable Reference

Contains all the boost::dll::import* reference counting functions that hold a shared pointer to the instance of boost::dll::shared_library.

result_type `const boost::dll::fs::path &

Path to shared library or shared library to load function from.

` `const char *

Null-terminated C or C++ mangled name of the function to import. Can handle std::string, char*, const char*.

` `load_mode::typeload_mode::default_mode

An mode that will be used on library load.

`
result_type `const boost::dll::fs::path &` `const std::string &` `load_mode::typeload_mode::default_mode`
result_type `const shared_library &` `const char *`
result_type `const shared_library &` `const std::string &`
result_type `shared_library &&` `const char *`
result_type `shared_library &&` `const std::string &`

Returns callable object or boost::shared_ptr<T> that holds the symbol imported from the loaded library. Returned value refcounts usage of the loaded shared library, so that it won't get unload until all copies of return value are not destroyed.

This call will succeed if call to boost::dll::shared_library`::has(const char* )` function with the same symbol name returned `true`.

For importing symbols by alias names use boost::dll::import_alias method.

Examples:

    boost::function<int(int)> f = import_symbol<int(int)>("test_lib.so", "integer_func_name");

    auto f_cpp11 = import_symbol<int(int)>("test_lib.so", "integer_func_name");

    boost::shared_ptr<int> i = import_symbol<int>("test_lib.so", "integer_name");

Template parameter T: Type of the symbol that we are going to import. Must be explicitly specified.

callable object if T is a function type, or boost::shared_ptr<T> if T is an object type.

``

result_type `const boost::dll::fs::path &

Path to shared library or shared library to load function from.

` `const char *

Null-terminated C or C++ mangled name of the function or variable to import. Can handle std::string, char*, const char*.

` `load_mode::typeload_mode::default_mode

An mode that will be used on library load.

`
result_type `const boost::dll::fs::path &` `const std::string &` `load_mode::typeload_mode::default_mode`
result_type `const shared_library &` `const char *`
result_type `const shared_library &` `const std::string &`
result_type `shared_library &&` `const char *`
result_type `shared_library &&` `const std::string &`

Returns callable object or boost::shared_ptr<T> that holds the symbol imported from the loaded library. Returned value refcounts usage of the loaded shared library, so that it won't get unload until all copies of return value are not destroyed.

This call will succeed if call to boost::dll::shared_library`::has(const char* )` function with the same symbol name returned `true`.

For importing symbols by non alias names use boost::dll::import method.

Examples:

    boost::function<int(int)> f = import_alias<int(int)>("test_lib.so", "integer_func_alias_name");

    auto f_cpp11 = import_alias<int(int)>("test_lib.so", "integer_func_alias_name");

    boost::shared_ptr<int> i = import_alias<int>("test_lib.so", "integer_alias_name");

Template parameter T: Type of the symbol alias that we are going to import. Must be explicitly specified.

callable object if T is a function type, or boost::shared_ptr<T> if T is an object type.

``

Contains the boost::dll::experimental::import_class function for importing classes.

Extremely experimental! Requires C++11! Will change in next version of Boost! boost/dll/import_class.hpp is not included in boost/dll.hpp

This class represents an imported class.

It must be constructed via boost::dll::import_class(const smart_library& lib, std::size_t, Args...)

`imported_class`< T >
unspecified typename ... `const smart_library &` `Args ...`
unspecified typename ... `const smart_library &` `std::size_t` `Args...`
typename ...
unspecified
const smart_library &
Args...
typename ...
unspecified
const smart_library &
std::size_t
Args...
typename ...
unspecified
smart_library &&
Args...
typename ...
unspecified
smart_library &&
std::size_t
Args...
`imported_class`< T > typename ... `smart_library &&` `Args...`
`imported_class`< T > typename ... `smart_library &&` `std::size_t` `Args...`
`imported_class`< T > typename ... `const smart_library &` `Args...`
`imported_class`< T > typename ... `const smart_library &` `std::size_t` `Args...`
T * Returns a pointer to the underlying class.
bool Check if the imported class is move-constructible.
bool Check if the imported class is move-assignable.
bool Check if the imported class is copy-constructible.
bool Check if the imported class is copy-assignable.
`imported_class`< T > Invoke the copy constructor.

Undefined behaviour if the imported object is not copy constructible.

`imported_class`< T > Invoke the move constructor.

Undefined behaviour if the imported object is not move constructible.

void `const `imported_class`< T > &` Invoke the copy assignment.

Undefined behaviour if the imported object is not copy assignable.

void ``imported_class`< T > &` Invoke the move assignment.

Undefined behaviour if the imported object is not move assignable.

bool Check if the class is loaded.
const std::type_info & Get a const reference to the std::type_info.
unspecified `const std::string &`

Call a member function. This returns a proxy to the function. The proxy mechanic mechanic is necessary, so the signaute can be passed.

Example

    im_class.call<void(const char*)>("function_name")("MyString");

unspecified boost::enable_if<detail::unqalified_is_same<T, Tin>> `const std::string &`

Call a qualified member function, i.e. const and or volatile.

Example

    im_class.call<const type_alias, void(const char*)>("function_name")("MyString");

unspecified `unspecified` Overload of ->* for an imported method.
unspecified class ... `const std::string &` Import a method of the class.
imported_class
&
imported_class
&&
Move constructor.
`imported_class` & ``imported_class` &`
`imported_class` & ``imported_class` &&` Move assignmend.
`imported_class`< T >

Class type or alias

typename ...

Constructor argument list.

const smart_library &

Path to shared library or shared library to load function from.

std::size_t
Args...
`imported_class`< T > typename ... `const smart_library &` `std::size_t` `const std::string &` `Args...`
`imported_class`< T > typename ... `const smart_library &` `const std::string &` `std::size_t` `Args...`
`imported_class`< T > typename ... `smart_library &&` `Args...`
`imported_class`< T > typename ... `smart_library &&` `const std::string &` `Args...`
`imported_class`< T > typename ... `smart_library &&` `std::size_t` `Args...`
`imported_class`< T > typename ... `smart_library &&` `std::size_t` `const std::string &` `Args...`
`imported_class`< T > typename ... `smart_library &&` `const std::string &` `std::size_t` `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.

class object.

``

`imported_class`< T > typename ... `smart_library &` `Args...`
`imported_class`< T > typename ... `smart_library &` `const std::string &` `Args...`
`imported_class`< T > typename ... `smart_library &` `std::size_t` `Args...`
`imported_class`< T > typename ... `smart_library &` `std::size_t` `const std::string &` `Args...`
`imported_class`< T > typename ... `smart_library &` `const std::string &` `std::size_t` `Args...`

Contains the boost::dll::experimental::import_mangled function for importing mangled symbols.

Extremely experimental! Requires C++11! Will change in next version of Boost! boost/dll/import_mangled.hpp is not included in boost/dll.hpp

result_type class ... `const boost::dll::fs::path &

Path to shared library or shared library to load function from.

` `const char *

Null-terminated C or C++ mangled name of the function to import. Can handle std::string, char*, const char*.

` `load_mode::typeload_mode::default_mode

An mode that will be used on library load.

`
result_type class ... `const boost::dll::fs::path &` `const std::string &` `load_mode::typeload_mode::default_mode`
result_type class ... `const smart_library &` `const char *`
result_type class ... `const smart_library &` `const std::string &`
result_type class ... `smart_library &&` `const char *`
result_type class ... `smart_library &&` `const std::string &`
result_type class ... `const shared_library &` `const char *`
result_type class ... `const shared_library &` `const std::string &`
result_type class ... `shared_library &&` `const char *`
result_type class ... `shared_library &&` `const std::string &`

Returns callable object or boost::shared_ptr<T> that holds the symbol imported from the loaded library. Returned value refcounts usage of the loaded shared library, so that it won't get unload until all copies of return value are not destroyed.

For importing symbols by alias names use boost::dll::import_alias method.

Examples:

    boost::function<int(int)> f = import_mangled<int(int)>("test_lib.so", "integer_func_name");

    auto f_cpp11 = import_mangled<int(int)>("test_lib.so", "integer_func_name");

    boost::shared_ptr<int> i = import_mangled<int>("test_lib.so", "integer_name");

Additionally you can also import overloaded symbols, including member-functions.

    auto fp = import_mangled<void(int), void(double)>("test_lib.so", "func");

    auto fp = import_mangled<my_class, void(int), void(double)>("test_lib.so", "func");

If qualified member-functions are needed, this can be set by repeating the class name with const or volatile. All following signatures after the redifintion will use this, i.e. the latest.

- *

      auto fp = import_mangled<my_class, void(int), void(double),
                               const my_class, void(int), void(double)>("test_lib.so", "func");

Template parameter T: Type of the symbol that we are going to import. Must be explicitly specified.

callable object if T is a function type, or boost::shared_ptr<T> if T is an object type.

``