#ifdef __linux__ #ifndef DL_MODEL_HPP #define DL_MODEL_HPP #define OPT_HEADER #include #include #include #include #include #include namespace opt_utilities { template model,std::string>* load_model(const char* fname) { void* handle; handle=dlopen(fname,RTLD_LAZY); if(!handle) { throw opt_exception("faild loading object"); } model,std::string>* (*func_create)(); func_create=(model,std::string>* (*)())dlsym(handle,"create_model_object"); if(!func_create) { throw opt_exception("symble undefined"); } return func_create(); } } #endif #endif //EOF