wxLibrary::wxLibrary(void *handle)
{
- typedef wxClassInfo **(*t_get_first)(void);
+ typedef wxClassInfo *(*t_get_first)(void);
t_get_first get_first;
m_handle = handle;
return info->CreateObject();
}
-void wxLibrary::PrepareClasses(wxClassInfo **first)
+void wxLibrary::PrepareClasses(wxClassInfo *first)
{
// Index all class infos by their class name
- wxClassInfo *info = *first;
+ wxClassInfo *info = first;
while (info)
{
if (info->m_className)
classTable.Put(info->m_className, (wxObject *)info);
- info = info->m_next;
+ info = info->GetNext();
}
// Set base pointers for each wxClassInfo
- info = *first;
+ info = first;
while (info)
{
if (info->GetBaseClassName1())
info->m_baseInfo2 = (wxClassInfo *)classTable.Get(info->GetBaseClassName2());
info = info->m_next;
}
- *first = NULL;
}
void *wxLibrary::GetSymbol(const wxString& symbname)
wxString lib_name = name;
wxNode *node;
wxLibrary *lib;
+ wxClassInfo *old_sm_first;
if ( (node = m_loaded.Find(name.GetData())) )
return ((wxLibrary *)node->Data());
+ // If DLL shares data, this is necessary.
+ old_sm_first = wxClassInfo::sm_first;
+ wxClassInfo::sm_first = NULL;
+
#if defined(__UNIX__)
lib_name.Prepend("./lib");
lib_name += ".so";
void *handle = dlopen(WXSTRINGCAST lib_name, RTLD_LAZY);
+ printf("error = %s\n", dlerror());
+
if (!handle)
return NULL;
#elif defined(__WINDOWS__)
lib = new wxLibrary((void *)handle);
+ wxClassInfo::sm_first = old_sm_first;
+
m_loaded.Append(name.GetData(), lib);
return lib;
}