Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Reference

Shared Library Reference
Shared Library Refcountable Reference

Shared Library Reference

Includes alias methods and macro. You can include this header or boost/dll/shared_library.hpp to reduce dependencies in case you do not use the refcountable functions.


BOOST_DLL_FORCE_ALIAS_INSTANTIATION
BOOST_DLL_FORCE_NO_WEAK_EXPORTS
BOOST_DLL_SELECTANY
BOOST_DLL_SECTION(SectionName, Permissions)
BOOST_DLL_ALIAS(FunctionOrVar, AliasName)
BOOST_DLL_ALIAS_SECTIONED(FunctionOrVar, AliasName, SectionName)
BOOST_DLL_AUTO_ALIAS(FunctionOrVar)

Imports filesystem, error_code, errc, system_error, make_error_code from Boost or C++17 into boost::dll::fs namespace.


BOOST_DLL_USE_STD_FS
namespace boost {
  namespace dll {
    namespace fs {
      typedef std::conditional_t< BOOST_DLL_USE_STD_FS, std::filesystem::path, boost::filesystem::path > path;
      typedef std::conditional_t< BOOST_DLL_USE_STD_FS, std::error_code, boost::system::error_code > error_code;
      typedef std::conditional_t< BOOST_DLL_USE_STD_FS, std::system_error, boost::system::system_error > system_error;
    }
  }
}

Contains only the boost::dll::library_info class that is capable of extracting different information from binaries.

namespace boost {
  namespace dll {
    class library_info;
  }
}

Provides methods for getting acceptable by boost::dll::shared_library location of symbol, source line or program.

namespace boost {
  namespace dll {
    template<typename T> 
      boost::dll::fs::path 
      symbol_location_ptr(T, boost::dll::fs::error_code &);
    template<typename T> 
      boost::dll::fs::path symbol_location_ptr(T ptr_to_symbol);
    template<typename T> 
      boost::dll::fs::path 
      symbol_location(const T &, boost::dll::fs::error_code &);
    template<typename T> 
      boost::dll::fs::path symbol_location(const T & symbol);
    boost::dll::fs::path this_line_location(boost::dll::fs::error_code &);
    boost::dll::fs::path this_line_location();
    boost::dll::fs::path program_location(boost::dll::fs::error_code &);
    boost::dll::fs::path program_location();
  }
}

Contains the boost::dll::shared_library class, core class for all the DLL/DSO operations.

namespace boost {
  namespace dll {
    class shared_library;

    // Very fast equality check that compares the actual DLL/DSO objects. Throws nothing. 
    bool operator==(const shared_library & lhs, const shared_library & rhs);

    // Very fast inequality check that compares the actual DLL/DSO objects. Throws nothing. 
    bool operator!=(const shared_library & lhs, const shared_library & rhs);

    // Compare the actual DLL/DSO objects without any guarantee to be stable between runs. Throws nothing. 
    bool operator<(const shared_library & lhs, const shared_library & rhs);

    // Swaps two shared libraries. Does not invalidate symbols and functions loaded from libraries. Throws nothing. 
    void swap(shared_library & lhs, shared_library & rhs);
  }
}

Contains only the boost::dll::load_mode::type enum and operators related to it.

namespace boost {
  namespace dll {
    namespace load_mode {
      enum type;

      // Free operators for load_mode::type flag manipulation. 
      BOOST_CONSTEXPR type operator|(type left, type right);
      BOOST_CXX14_CONSTEXPR type & operator|=(type & left, type right);
      BOOST_CONSTEXPR type operator&(type left, type right);
      BOOST_CXX14_CONSTEXPR type & operator&=(type & left, type right);
      BOOST_CONSTEXPR type operator^(type left, type right);
      BOOST_CXX14_CONSTEXPR type & operator^=(type & left, type right);
      BOOST_CONSTEXPR type operator~(type left);
    }
  }
}

Contains the boost::dll::experimental::smart_library class for loading mangled symbols.

[Warning] Warning

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

namespace boost {
  namespace dll {
    namespace experimental {
      class smart_library;

      // Very fast equality check that compares the actual DLL/DSO objects. Throws nothing. 
      bool operator==(const smart_library & lhs, const smart_library & rhs);

      // Very fast inequality check that compares the actual DLL/DSO objects. Throws nothing. 
      bool operator!=(const smart_library & lhs, const smart_library & rhs);

      // Compare the actual DLL/DSO objects without any guarantee to be stable between runs. Throws nothing. 
      bool operator<(const smart_library & lhs, const smart_library & rhs);

      // Swaps two shared libraries. Does not invalidate symbols and functions loaded from libraries. Throws nothing. 
      void swap(smart_library & lhs, smart_library & rhs);
      template<typename T, typename T2> 
        void get(const smart_library &, const std::string &);
      template<typename T> 
        boost::enable_if< boost::is_object< T >, T & >::type 
        get(const smart_library & sm, const std::string & name);
      template<typename T> 
        boost::enable_if< boost::is_function< T >, T & >::type 
        get(const smart_library & sm, const std::string & name);
      template<typename Class, typename Signature> 
        auto get(const smart_library &, const std::string &);
    }
  }
}

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.

namespace boost {
  namespace dll {
    template<typename T> 
      result_type import_symbol(const boost::dll::fs::path &, const char *, 
                                load_mode::type = load_mode::default_mode);
    template<typename T> 
      result_type import_symbol(const boost::dll::fs::path & lib, 
                                const std::string & name, 
                                load_mode::type mode = load_mode::default_mode);
    template<typename T> 
      result_type import_symbol(const shared_library & lib, const char * name);
    template<typename T> 
      result_type import_symbol(const shared_library & lib, 
                                const std::string & name);
    template<typename T> 
      result_type import_symbol(shared_library && lib, const char * name);
    template<typename T> 
      result_type import_symbol(shared_library && lib, 
                                const std::string & name);
    template<typename T> 
      result_type import_alias(const boost::dll::fs::path &, const char *, 
                               load_mode::type = load_mode::default_mode);
    template<typename T> 
      result_type import_alias(const boost::dll::fs::path & lib, 
                               const std::string & name, 
                               load_mode::type mode = load_mode::default_mode);
    template<typename T> 
      result_type import_alias(const shared_library & lib, const char * name);
    template<typename T> 
      result_type import_alias(const shared_library & lib, 
                               const std::string & name);
    template<typename T> 
      result_type import_alias(shared_library && lib, const char * name);
    template<typename T> 
      result_type import_alias(shared_library && lib, 
                               const std::string & name);
  }
}

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

[Warning] Warning

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

namespace boost {
  namespace dll {
    namespace experimental {
      template<typename T> class imported_class;
      template<typename T, typename ... Args> 
        imported_class< T > 
        import_class(const smart_library & lib, Args... args);
      template<typename T, typename ... Args> 
        imported_class< T > 
        import_class(const smart_library & lib, 
                     const std::string & alias_name, Args... args);
      template<typename T, typename ... Args> 
        imported_class< T > 
        import_class(const smart_library &, std::size_t, 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);
      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);
    }
  }
}

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

[Warning] Warning

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

namespace boost {
  namespace dll {
    namespace experimental {
      template<class ... Args> 
        result_type import_mangled(const boost::dll::fs::path &, const char *, 
                                   load_mode::type = load_mode::default_mode);
      template<class ... Args> 
        result_type import_mangled(const boost::dll::fs::path & lib, 
                                   const std::string & name, 
                                   load_mode::type mode = load_mode::default_mode);
      template<class ... Args> 
        result_type import_mangled(const smart_library & lib, 
                                   const char * name);
      template<class ... Args> 
        result_type import_mangled(const smart_library & lib, 
                                   const std::string & name);
      template<class ... Args> 
        result_type import_mangled(smart_library && lib, const char * name);
      template<class ... Args> 
        result_type import_mangled(smart_library && lib, 
                                   const std::string & name);
      template<class ... Args> 
        result_type import_mangled(const shared_library & lib, 
                                   const char * name);
      template<class ... Args> 
        result_type import_mangled(const shared_library & lib, 
                                   const std::string & name);
      template<class ... Args> 
        result_type import_mangled(shared_library && lib, const char * name);
      template<class ... Args> 
        result_type import_mangled(shared_library && lib, 
                                   const std::string & name);
    }
  }
}

PrevUpHomeNext