#include "globals.h" // Functions addresses G_funcsType G_funcs; // Loaded modules G_libsType G_libs; /* // Variables definitions G_VarType G_Vars; // List of objects to save G_ExecType G_ToSave; // List of objects to print G_ExecType G_ToPrint; */ void ClearGlobals() { for(auto& it:G_libs) dlclose(it); //G_Vars.clear(); //G_ToPrint.clear(); //G_ToSave.clear(); } int LoadModule(const std::string& name, const void* p, const std::string& modname) { const std::string spath=*(reinterpret_cast(p)); // Load module void* handle; void* initfunc; std::string initname; if(0!=modname.size()) initname=modname; else { // Remove directory name, if present initname=name.substr((name.rfind('/')!=std::string::npos)?(name.rfind('/')+1):0,std::string::npos); // Remove ".so" on the end of string if(initname.rfind(".so")!=std::string::npos) initname.erase(initname.rfind(".so"),std::string::npos); } initname+="_module_init"; // Check if module is statically linked or already loaded: dlopen'ed the main program handle=dlopen(0,RTLD_LAZY|RTLD_GLOBAL); if(0==handle) { COUT(ERROR)<(initfunc))(p); if(0!=ret) COUT(ERROR)<Size(), i; if(sz<2 || sz%2==1 ) { COUT(ERROR)<<"Number of save arguments must not be "<(input->At(i*2+1))) { COUT(ERROR)<<"Save format is save(object_1,file_1,...,object_n,file_n) where file_i is string"<At(i*2); OBType arg2(input->At(i*2+1)); if(!arg1->Save(arg2->Value().c_str())) { COUT(ERROR)<<"Can't save object "<Dump()<<" to file "<Value()<Size(), i; if(sz==0) return true; // Print for(i=0;iAt(i)->Print()) { COUT(ERROR)<<"Unprintable object "<At(i)->Dump()<