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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
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);
    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 &);
    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++14! 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> 
        T & get(const smart_library & sm, const std::string & name, 
                typename boost::enable_if< boost::is_object< T >, T >::type * = nullptr);
      template<typename T> 
        auto get(const smart_library & sm, const std::string & name, 
                 typename boost::enable_if< boost::is_function< T >>::type * = nullptr);
      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(const boost::dll::fs::path &, const char *, 
                         load_mode::type = load_mode::default_mode);
    template<typename T> 
      result_type import(const boost::dll::fs::path &, const std::string &, 
                         load_mode::type = load_mode::default_mode);
    template<typename T> 
      result_type import(const shared_library &, const char *);
    template<typename T> 
      result_type import(const shared_library &, const std::string &);
    template<typename T> result_type import(shared_library &&, const char *);
    template<typename T> 
      result_type import(shared_library &&, const std::string &);
    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 &, 
                               const std::string &, 
                               load_mode::type = load_mode::default_mode);
    template<typename T> 
      result_type import_alias(const shared_library &, const char *);
    template<typename T> 
      result_type import_alias(const shared_library &, const std::string &);
    template<typename T> 
      result_type import_alias(shared_library &&, const char *);
    template<typename T> 
      result_type import_alias(shared_library &&, const std::string &);
  }
}
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 &, std::size_t, Args...);
      template<typename T, typename ... Args> 
        imported_class< T > 
        import_class(const smart_library &, std::size_t, const std::string &, 
                     Args...);
      template<typename T, typename ... Args> 
        imported_class< T > 
        import_class(const smart_library &, const std::string &, std::size_t, 
                     Args...);
      template<typename T, typename ... Args> 
        imported_class< T > import_class(smart_library &&, Args...);
      template<typename T, typename ... Args> 
        imported_class< T > 
        import_class(smart_library &&, const std::string &, Args...);
      template<typename T, typename ... Args> 
        imported_class< T > 
        import_class(smart_library &&, std::size_t, Args...);
      template<typename T, typename ... Args> 
        imported_class< T > 
        import_class(smart_library &&, std::size_t, const std::string &, 
                     Args...);
      template<typename T, typename ... Args> 
        imported_class< T > 
        import_class(smart_library &&, const std::string &, std::size_t, 
                     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);
    }
  }
}
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 &, 
                                   const std::string &, 
                                   load_mode::type = load_mode::default_mode);
      template<class ... Args> 
        result_type import_mangled(const smart_library &, const char *);
      template<class ... Args> 
        result_type import_mangled(const smart_library &, const std::string &);
      template<class ... Args> 
        result_type import_mangled(smart_library &&, const char *);
      template<class ... Args> 
        result_type import_mangled(smart_library &&, const std::string &);
      template<class ... Args> 
        result_type import_mangled(const shared_library &, const char *);
      template<class ... Args> 
        result_type import_mangled(const shared_library &, 
                                   const std::string &);
      template<class ... Args> 
        result_type import_mangled(shared_library &&, const char *);
      template<class ... Args> 
        result_type import_mangled(shared_library &&, const std::string &);
    }
  }
}

PrevUpHomeNext