Added cppunit to the ./contrib dir. Build config for x64 and dll builds (some bugs remaining, but most configs are working)
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@70 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
77
contrib/cppunit-1.12.1/src/cppunit/DynamicLibraryManager.cpp
Normal file
77
contrib/cppunit-1.12.1/src/cppunit/DynamicLibraryManager.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
#include <cppunit/plugin/DynamicLibraryManager.h>
|
||||
|
||||
#if !defined(CPPUNIT_NO_TESTPLUGIN)
|
||||
#include <cppunit/plugin/DynamicLibraryManagerException.h>
|
||||
|
||||
CPPUNIT_NS_BEGIN
|
||||
|
||||
|
||||
DynamicLibraryManager::DynamicLibraryManager( const std::string &libraryFileName )
|
||||
: m_libraryHandle( NULL )
|
||||
, m_libraryName( libraryFileName )
|
||||
{
|
||||
loadLibrary( libraryFileName );
|
||||
}
|
||||
|
||||
|
||||
DynamicLibraryManager::~DynamicLibraryManager()
|
||||
{
|
||||
releaseLibrary();
|
||||
}
|
||||
|
||||
|
||||
DynamicLibraryManager::Symbol
|
||||
DynamicLibraryManager::findSymbol( const std::string &symbol )
|
||||
{
|
||||
try
|
||||
{
|
||||
Symbol symbolPointer = doFindSymbol( symbol );
|
||||
if ( symbolPointer != NULL )
|
||||
return symbolPointer;
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
}
|
||||
|
||||
throw DynamicLibraryManagerException( m_libraryName,
|
||||
symbol,
|
||||
DynamicLibraryManagerException::symbolNotFound );
|
||||
return NULL; // keep compiler happy
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DynamicLibraryManager::loadLibrary( const std::string &libraryName )
|
||||
{
|
||||
try
|
||||
{
|
||||
releaseLibrary();
|
||||
m_libraryHandle = doLoadLibrary( libraryName );
|
||||
if ( m_libraryHandle != NULL )
|
||||
return;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
throw DynamicLibraryManagerException( m_libraryName,
|
||||
getLastErrorDetail(),
|
||||
DynamicLibraryManagerException::loadingFailed );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DynamicLibraryManager::releaseLibrary()
|
||||
{
|
||||
if ( m_libraryHandle != NULL )
|
||||
{
|
||||
doReleaseLibrary();
|
||||
m_libraryHandle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CPPUNIT_NS_END
|
||||
|
||||
|
||||
#endif // !defined(CPPUNIT_NO_TESTPLUGIN)
|
||||
Reference in New Issue
Block a user