36 using namespace ::
std;
42 #define SO_EXT "dylib" 43 #elif defined (WINDOWS) || defined (CYGWIN) 50 #if defined (UNIX) || defined(CYGWIN) 59 # define PATH_SEPARATOR ":" 61 #define PATH_SEPARATOR ";" 67 MEMORY_BASIC_INFORMATION mbi;
69 return (HMODULE) mbi.AllocationBase;
77 #ifndef G2O_LIBRARY_POSTFIX 78 #define G2O_LIBRARY_POSTFIX "" 86 void findArguments(
const std::string& option, vector<string>& args,
int argc,
char** argv)
89 for (
int i = 0; i < argc; ++i) {
90 if (argv[i] == option && i + 1 < argc) {
91 args.push_back(argv[i+1]);
98 char * envTypesPath = getenv(
"G2O_TYPES_DIR");
101 if (envTypesPath != NULL) {
102 typesPath = envTypesPath;
104 typesPath = G2O_DEFAULT_TYPES_DIR_;
106 if (dladdr(&info, &info) != 0) {
109 #elif (defined WINDOWS) 110 char libFilename[MAX_PATH + 1];
112 if (instance && GetModuleFileName(instance, libFilename, MAX_PATH) > 0) {
119 for (vector<string>::const_iterator it = paths.begin(); it != paths.end(); ++it) {
125 if (argc > 0 && argv != 0)
127 for (vector<string>::const_iterator it = libs.begin(); it != libs.end(); ++it) {
128 cerr <<
"Loading types " << *it << endl;
135 char * envSolversPath = getenv(
"G2O_SOLVERS_DIR");
136 string solversPath = G2O_DEFAULT_SOLVERS_DIR_;
138 if (envSolversPath != NULL) {
139 solversPath = envSolversPath;
142 if (dladdr(&info, &info) != 0) {
145 #elif (defined WINDOWS) 146 char libFilename[MAX_PATH + 1];
148 if (instance && GetModuleFileName(instance, libFilename, MAX_PATH) > 0) {
155 for (vector<string>::const_iterator it = paths.begin(); it != paths.end(); ++it) {
161 if (argc > 0 && argv != 0)
163 for (vector<string>::const_iterator it = libs.begin(); it != libs.end(); ++it) {
164 cerr <<
"Loading solver " << *it << endl;
#define G2O_LIBRARY_POSTFIX
int openLibraries(const std::string &directory, const std::string &pattern="")
void loadStandardTypes(DlWrapper &dlTypesWrapper, int argc, char **argv)
static const string SOLVERS_PATTERN
bool openLibrary(const std::string &filename)
void findArguments(const std::string &option, vector< string > &args, int argc, char **argv)
static void fakeFunctionForWindows()
std::string getDirname(const std::string &filename)
std::vector< std::string > strSplit(const std::string &str, const std::string &delimiters)
void loadStandardSolver(DlWrapper &dlSolverWrapper, int argc, char **argv)
static const string TYPES_PATTERN
Loading libraries during run-time.