|
From: <cn...@us...> - 2009-05-26 03:26:09
|
Revision: 279
http://hgengine.svn.sourceforge.net/hgengine/?rev=279&view=rev
Author: cnlohr
Date: 2009-05-26 03:26:06 +0000 (Tue, 26 May 2009)
Log Message:
-----------
fixup Unicode on Windows
Modified Paths:
--------------
Mercury2/src/ModuleManager.cpp
Modified: Mercury2/src/ModuleManager.cpp
===================================================================
--- Mercury2/src/ModuleManager.cpp 2009-05-26 03:23:41 UTC (rev 278)
+++ Mercury2/src/ModuleManager.cpp 2009-05-26 03:26:06 UTC (rev 279)
@@ -10,7 +10,7 @@
#define RTLD_NOW 0
#define RTLD_GLOBAL 0
-void * dlopen( const char * sFile, int dummy ) { return LoadLibrary( sFile ); }
+void * dlopen( const char * sFile, int dummy ) { return LoadLibrary( (LPCWSTR)sFile ); }
void dlclose( void * handle ) { FreeLibrary( (HMODULE)handle ); }
void * dlsym( void * handle, const char * sym ) { return GetProcAddress( (HMODULE) handle, sym ); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-23 04:54:38
|
Revision: 362
http://hgengine.svn.sourceforge.net/hgengine/?rev=362&view=rev
Author: cnlohr
Date: 2009-06-23 04:54:38 +0000 (Tue, 23 Jun 2009)
Log Message:
-----------
be more descriptive, especially when something goes wrong, report the linking error.
Modified Paths:
--------------
Mercury2/src/ModuleManager.cpp
Modified: Mercury2/src/ModuleManager.cpp
===================================================================
--- Mercury2/src/ModuleManager.cpp 2009-06-23 04:54:16 UTC (rev 361)
+++ Mercury2/src/ModuleManager.cpp 2009-06-23 04:54:38 UTC (rev 362)
@@ -38,12 +38,13 @@
{
XMLDocument* doc = XMLDocument::Load("modules.xml");
XMLNode r = doc->GetRootNode();
- for (XMLNode child = r.Child(); child.IsValid(); child = r.NextNode())
+ for (XMLNode child = r.Child(); child.IsValid(); child = child.NextNode())
{
if( child.Name() != "Module" )
{
fprintf( stderr, "Invalid element in modules: %s\n", child.Name().c_str() );
}
+ printf( "Loading: %s\n", child.Attribute( "obj" ).c_str() );
#ifdef WIN32
MString ModuleName = child.Attribute( "obj" ) + ".dll";
#else
@@ -63,11 +64,13 @@
bool ModuleManager::LoadModule( const MString & ModuleName, const MString & LoadFunction )
{
if( m_hAllHandles[ModuleName] ) UnloadModule( ModuleName );
- m_hAllHandles[ModuleName] = dlopen( ModuleName.c_str(), RTLD_NOW | RTLD_GLOBAL );
+ void * v = dlopen( ModuleName.c_str(), RTLD_NOW | RTLD_GLOBAL );
+ m_hAllHandles[ModuleName] = v;
+
if( !m_hAllHandles[ModuleName] )
{
- fprintf( stderr, "Error opening: %s\n", ModuleName.c_str() );
+ fprintf( stderr, "Error opening: %s (%s)\n", ModuleName.c_str(), dlerror() );
return false;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-27 22:24:54
|
Revision: 382
http://hgengine.svn.sourceforge.net/hgengine/?rev=382&view=rev
Author: cnlohr
Date: 2009-06-27 22:24:47 +0000 (Sat, 27 Jun 2009)
Log Message:
-----------
Windows doesn't tell you whats wrong when you dynamically link things.
Modified Paths:
--------------
Mercury2/src/ModuleManager.cpp
Modified: Mercury2/src/ModuleManager.cpp
===================================================================
--- Mercury2/src/ModuleManager.cpp 2009-06-27 22:24:29 UTC (rev 381)
+++ Mercury2/src/ModuleManager.cpp 2009-06-27 22:24:47 UTC (rev 382)
@@ -70,7 +70,12 @@
if( !m_hAllHandles[ModuleName] )
{
+#ifdef WIN32
+ fprintf( stderr, "Error opening: %s\n", ModuleName.c_str() );
+#else
fprintf( stderr, "Error opening: %s (%s)\n", ModuleName.c_str(), dlerror() );
+#endif
+
return false;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-08-18 05:47:46
|
Revision: 490
http://hgengine.svn.sourceforge.net/hgengine/?rev=490&view=rev
Author: cnlohr
Date: 2009-08-18 05:47:39 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
fix memory leak
Modified Paths:
--------------
Mercury2/src/ModuleManager.cpp
Modified: Mercury2/src/ModuleManager.cpp
===================================================================
--- Mercury2/src/ModuleManager.cpp 2009-08-18 05:47:27 UTC (rev 489)
+++ Mercury2/src/ModuleManager.cpp 2009-08-18 05:47:39 UTC (rev 490)
@@ -26,6 +26,7 @@
{
}
+
ModuleManager & ModuleManager::GetInstance()
{
static ModuleManager *instance = NULL;
@@ -53,6 +54,7 @@
MString LoadFunct = child.Attribute( "func" );
LoadModule( ModuleName, LoadFunct );
}
+ delete doc;
}
void ModuleManager::UnloadModule( const MString & ModuleName )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-10-25 20:37:53
|
Revision: 581
http://hgengine.svn.sourceforge.net/hgengine/?rev=581&view=rev
Author: cnlohr
Date: 2009-10-25 20:37:45 +0000 (Sun, 25 Oct 2009)
Log Message:
-----------
oops -- forgot to check for unregistered objects
Modified Paths:
--------------
Mercury2/src/ModuleManager.cpp
Modified: Mercury2/src/ModuleManager.cpp
===================================================================
--- Mercury2/src/ModuleManager.cpp 2009-10-25 20:28:46 UTC (rev 580)
+++ Mercury2/src/ModuleManager.cpp 2009-10-25 20:37:45 UTC (rev 581)
@@ -139,7 +139,13 @@
void ModuleManager::UnregisterInstance( void * instance )
{
- const char * sClass = m_pAllInstanceTypes[instance];
+ std::map< void *, const char * >::iterator ni = m_pAllInstanceTypes.find( instance );
+
+ //Object was never registered.
+ if( ni == m_pAllInstanceTypes.end() )
+ return;
+
+ const char * sClass = ni->second;
std::set< void * > & s = m_hAllInstances[sClass];
std::set< void * >::iterator i = s.find( instance );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|