diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-04-15 14:33:11 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-04-15 14:33:11 +0000 |
| commit | 1b4bcf6f703248cb397587fe08635a1491d460ec (patch) | |
| tree | e0ae81d803807027d7b4a6f14d9c39da2321dd47 /src/cppunit/DynamicLibraryManager.cpp | |
| parent | 5f5af41d52c01c8320baffea21cd60ebbb16380b (diff) | |
| download | cppunit-1b4bcf6f703248cb397587fe08635a1491d460ec.tar.gz | |
NEWS: updated.
NEWS: updated.
* configure.in: added include/cppunit/config/Makefile and
include/cppunit/plugin/Makefile to the list of target.
* doc/CppUnit-win.dox: enabled generation of HTML Help documentation.
* include/cppunit/config/Makefile.am:
* include/cppunit/plugin/Makefile.am: added.
* include/cppunit/config-bcb5.h:
* include/cppunit/config-msvc6.h:
* include/cppunit/config-mac.h: moved to include/cppunit/config/.
* include/cppunit/Portability.h: updated config files location. Added macros
CPPUNIT_STRINGIZE and CPPUNIT_JOIN (implementation adapted from boost.org).
Added macro CPPUNIT_MAKE_UNIQUE_NAME.
* include/cppunit/Test.h: modified methods order.
* include/cppunit/extensions/HelperMacros.h: renamed macro
__CPPUNIT_MAKE_UNIQUE_NAME to CPPUNIT_MAKE_UNIQUE_NAME and moved its
definition to include/cppunit/Portability.h.
* include/cppunit/extensions/TestDecorator.h: Inherits Test instead of TestLeaf.
* include/cppunit/plugin/DynamicLibraryManager.h:
* src/cppunit/DynamicLibraryManager.cpp: added. DLL manager (load & lookup
symbol).
* src/cppunit/BeOsDynamicLibraryManager.cpp:
* src/cppunit/UnixDynamicLibraryManager.cpp:
* src/cppunit/Win32DynamicLibraryManager.cpp: added. Implementation of
platform dependent methods of DynamicLibraryManager.
* include/cppunit/plugin/DynamicLibraryManagerException.h:
* src/cppunit/DynamicLibraryManagerException.cpp: added. Exception thrown
by DynamicLibraryManager.
* include/cppunit/plugin/TestPlugIn.h: added. CppUnitTestPlugIn interface
definition. Helper macros to implements plug-in.
* include/cppunit/plugin/TestPlugInSuite.h:
* src/cppunit/plugin/TestPlugInSuite.cpp: added. A suite to wrap a test
plug-in.
* include/cppunit/plugin/TestPlugInDefaultImpl.h:
* src/cppunit/TestPlugInDefaultImpl.cpp: added. A default implementation
of the test plug-in interface.
* src/msvc6/DllPlugInTester/DllPlugInTester.cpp: updated to use the
new TestPlugIn.
* examples/cppunittest/TestResultCollectorTest.cpp: fixed typo.
Diffstat (limited to 'src/cppunit/DynamicLibraryManager.cpp')
| -rw-r--r-- | src/cppunit/DynamicLibraryManager.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/cppunit/DynamicLibraryManager.cpp b/src/cppunit/DynamicLibraryManager.cpp new file mode 100644 index 0000000..1c92e3e --- /dev/null +++ b/src/cppunit/DynamicLibraryManager.cpp @@ -0,0 +1,73 @@ +#include <cppunit/plugin/DynamicLibraryManager.h> + +#if !defined(CPPUNIT_NO_TESTPLUGIN) +#include <cppunit/plugin/DynamicLibraryManagerException.h> + +namespace CppUnit +{ + + +DynamicLibraryManager::DynamicLibraryManager( const std::string &libraryFileName ) + : m_libraryHandle( NULL ) +{ + 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 ); + 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 ); +} + + +void +DynamicLibraryManager::releaseLibrary() +{ + if ( m_libraryHandle != NULL ) + { + doReleaseLibrary(); + m_libraryHandle = NULL; + } +} + + +} // namespace CppUnit + + +#endif // !defined(CPPUNIT_NO_TESTPLUGIN) |
