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

F.A.Q.










Workaround would be to write plugin into a temporary file in RAM and load plugin from it:

#include <boost/filesystem.hpp>
#include <boost/dll.hpp>
using namespace boost;

dll:shared_library load_from_memory(unsigned char* data, std::size_t size, const filesystem::path& tmp_plugin_path = filesystem::unique_path() / "libplugin.so") {
    const filesystem::path plugin_location = filesystem::temp_directory_path() / tmp_plugin_path;
    filesystem::create_directories(plugin_location.parent_path());
    filesystem::ofstream ofs(plugin_location, std::ios::out|std::ios::bin|std::ios::trunc);
    ofs.write(data, size);

    return dll::shared_library(plugin_location);
}

But there's no guarantee that filesystem::temp_directory_path() will actually write to RAM, that's very platform dependent.



PrevUpHomeNext