# 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::filesystem::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::filesystem::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<int(int)>("test_lib.so", "integer_func_name");

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

     boost::shared_ptr<int> i = import<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.

`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.

result_type `const boost::filesystem::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::filesystem::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.

`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.