/////////////////////////////////////////////////////////////////////////////
-// Name: dynload.cpp
+// Name: src/common/dynload.cpp
// Purpose: Dynamic loading framework
// Author: Ron Lee, David Falkinder, Vadim Zeitlin and a cast of 1000's
// (derived in part from dynlib.cpp (c) 1998 Guilhem Lavaux)
#include "wx/intl.h"
#include "wx/hash.h"
#include "wx/utils.h"
+ #include "wx/module.h"
#endif
#include "wx/strconv.h"
#include "wx/dynload.h"
-#include "wx/module.h"
// ---------------------------------------------------------------------------
virtual void OnExit()
{
- delete wxPluginLibrary::ms_classes;
- wxPluginLibrary::ms_classes = NULL;
+ wxDELETE(wxPluginLibrary::ms_classes);
wxPluginManager::ClearManifest();
}
: m_linkcount(1)
, m_objcount(0)
{
- m_before = wxClassInfo::sm_first;
+ m_before = wxClassInfo::GetFirst();
Load( libname, flags );
- m_after = wxClassInfo::sm_first;
+ m_after = wxClassInfo::GetFirst();
if( m_handle != 0 )
{
wxPluginLibrary *wxPluginLibrary::RefLib()
{
wxCHECK_MSG( m_linkcount > 0, NULL,
- _T("Library had been already deleted!") );
+ wxT("Library had been already deleted!") );
++m_linkcount;
return this;
bool wxPluginLibrary::UnrefLib()
{
wxASSERT_MSG( m_objcount == 0,
- _T("Library unloaded before all objects were destroyed") );
+ wxT("Library unloaded before all objects were destroyed") );
if ( m_linkcount == 0 || --m_linkcount == 0 )
{
void wxPluginLibrary::UpdateClasses()
{
- for (wxClassInfo *info = m_after; info != m_before; info = info->m_next)
+ for (const wxClassInfo *info = m_after; info != m_before; info = info->GetNext())
{
if( info->GetClassName() )
{
if (!ms_classes)
return;
- for(wxClassInfo *info = m_after; info != m_before; info = info->m_next)
+ for(const wxClassInfo *info = m_after; info != m_before; info = info->GetNext())
{
ms_classes->erase(ms_classes->find(info->GetClassName()));
}
// though, as there is currently no way to Unregister it without it.
wxASSERT_MSG( m_linkcount == 1,
- _T("RegisterModules should only be called for the first load") );
+ wxT("RegisterModules should only be called for the first load") );
- for ( wxClassInfo *info = m_after; info != m_before; info = info->m_next)
+ for ( const wxClassInfo *info = m_after; info != m_before; info = info->GetNext())
{
if( info->IsKindOf(CLASSINFO(wxModule)) )
{
wxModule *m = wxDynamicCast(info->CreateObject(), wxModule);
- wxASSERT_MSG( m, _T("wxDynamicCast of wxModule failed") );
+ wxASSERT_MSG( m, wxT("wxDynamicCast of wxModule failed") );
m_wxmodules.push_back(m);
wxModule::RegisterModule(m);
{
if( !(*it)->Init() )
{
- wxLogDebug(_T("wxModule::Init() failed for wxPluginLibrary"));
+ wxLogDebug(wxT("wxModule::Init() failed for wxPluginLibrary"));
// XXX: Watch this, a different hash implementation might break it,
// a good hash implementation would let us fix it though.
if ( entry )
{
- wxLogTrace(_T("dll"),
- _T("LoadLibrary(%s): already loaded."), realname.c_str());
+ wxLogTrace(wxT("dll"),
+ wxT("LoadLibrary(%s): already loaded."), realname.c_str());
entry->RefLib();
}
{
(*ms_manifest)[realname] = entry;
- wxLogTrace(_T("dll"),
- _T("LoadLibrary(%s): loaded ok."), realname.c_str());
+ wxLogTrace(wxT("dll"),
+ wxT("LoadLibrary(%s): loaded ok."), realname.c_str());
}
else
{
- wxLogTrace(_T("dll"),
- _T("LoadLibrary(%s): failed to load."), realname.c_str());
+ wxLogTrace(wxT("dll"),
+ wxT("LoadLibrary(%s): failed to load."), realname.c_str());
// we have created entry just above
if ( !entry->UnrefLib() )
{
// ... so UnrefLib() is supposed to delete it
- wxFAIL_MSG( _T("Currently linked library is not loaded?") );
+ wxFAIL_MSG( wxT("Currently linked library is not loaded?") );
}
entry = NULL;
if ( !entry )
{
- wxLogDebug(_T("Attempt to unload library '%s' which is not loaded."),
+ wxLogDebug(wxT("Attempt to unload library '%s' which is not loaded."),
libname.c_str());
return false;
}
- wxLogTrace(_T("dll"), _T("UnloadLibrary(%s)"), realname.c_str());
+ wxLogTrace(wxT("dll"), wxT("UnloadLibrary(%s)"), realname.c_str());
if ( !entry->UnrefLib() )
{
void wxPluginManager::Unload()
{
- wxCHECK_RET( m_entry, _T("unloading an invalid wxPluginManager?") );
+ wxCHECK_RET( m_entry, wxT("unloading an invalid wxPluginManager?") );
for ( wxDLManifest::iterator i = ms_manifest->begin();
i != ms_manifest->end();
}
#endif // wxUSE_DYNAMIC_LOADER
-