+wxLibrary *wxLibraries::LoadLibrary(const wxString& name)
+{
+ wxNode *node;
+ wxLibrary *lib;
+ wxClassInfo *old_sm_first;
+
+#if defined(__VISAGECPP__)
+ node = m_loaded.Find(name.GetData());
+ if (node != NULL)
+ return ((wxLibrary *)node->Data());
+#else // !OS/2
+ if ( (node = m_loaded.Find(name.GetData())) )
+ return ((wxLibrary *)node->Data());
+#endif
+ // If DLL shares data, this is necessary.
+ old_sm_first = wxClassInfo::sm_first;
+ wxClassInfo::sm_first = NULL;
+
+ wxString libname = ConstructLibraryName(name);
+
+/*
+ Unix automatically builds that library name, at least for dlopen()
+*/
+#if 0
+#if defined(__UNIX__)
+ // found the first file in LD_LIBRARY_PATH with this name
+ wxString libPath("/lib:/usr/lib"); // system path first
+ const char *envLibPath = getenv("LD_LIBRARY_PATH");
+ if ( envLibPath )
+ libPath << wxT(':') << envLibPath;
+ wxStringTokenizer tokenizer(libPath, wxT(':'));
+ while ( tokenizer.HasMoreToken() )
+ {
+ wxString fullname(tokenizer.NextToken());
+
+ fullname << wxT('/') << libname;
+ if ( wxFileExists(fullname) )
+ {
+ libname = fullname;
+
+ // found the library
+ break;
+ }
+ }
+ //else: not found in the path, leave the name as is (secutiry risk?)
+
+#endif // __UNIX__
+#endif