1 #include <ail/module.hpp>
9 dynamic_module::dynamic_module():
14 dynamic_module::~dynamic_module()
19 bool dynamic_module::load(std::string
const & new_path
)
22 module_handle
= ::LoadLibrary(new_path
.c_str());
24 module_handle
= ::dlopen(new_path
.c_str(), RTLD_LAZY
);
27 is_loaded
= module_handle
!= 0;
34 void dynamic_module::unload()
39 ::FreeLibrary(module_handle
);
41 ::dlclose(module_handle
);
47 bool dynamic_module::get_function(std::string
const & name
, void * & output
)
53 output
= ::GetProcAddress(module_handle
, name
.c_str());
56 boost::mutex::scoped_lock
scoped_lock(mutex
)
57 output
= ::dlsym(module_handle
, name
.c_str());
58 return dlerror() == 0;