2#ifndef CYCLUS_SRC_UNIX_HELPER_FUNCTIONS_H_
3#define CYCLUS_SRC_UNIX_HELPER_FUNCTIONS_H_
13void DynamicModule::OpenLibrary() {
15 module_library_ = dlopen(path_.c_str(), RTLD_NOW);
17 if (!module_library_) {
18 std::string err_msg =
"Unable to load agent shared object file: ";
20 throw IOError(err_msg);
27void DynamicModule::SetConstructor() {
29 dlsym(module_library_, ctor_name_.c_str());
33 std::string agent = ctor_name_;
35 ss <<
"Could not find agent " << agent <<
" in module library "
36 << path_.c_str() <<
" (" << dlerror() <<
").";
37 throw IOError(ss.str());
44void DynamicModule::CloseLibrary() {
45 if (module_library_) {
46 int exit_code = dlclose(module_library_);
48 std::string err_msg =
"Error closing shared object file: ";
50 throw IOError(err_msg);
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
Agent * AgentCtor(Context *)