Imported Upstream version 2.81
[platform/upstream/libbullet.git] / UnitTests / cppunit / src / cppunit / ShlDynamicLibraryManager.cpp
1 #include <cppunit/Portability.h>
2
3 #if defined(CPPUNIT_HAVE_UNIX_SHL_LOADER)
4 #include <cppunit/plugin/DynamicLibraryManager.h>
5
6 #include <dl.h>
7 #include <unistd.h>
8
9
10 CPPUNIT_NS_BEGIN
11
12
13 DynamicLibraryManager::LibraryHandle 
14 DynamicLibraryManager::doLoadLibrary( const std::string &libraryName )
15 {
16    return ::shl_load(libraryName.c_str(), BIND_IMMEDIATE, 0L);
17 }
18
19
20 void 
21 DynamicLibraryManager::doReleaseLibrary()
22 {
23   ::shl_unload( (shl_t)m_libraryHandle);
24 }
25
26
27 DynamicLibraryManager::Symbol 
28 DynamicLibraryManager::doFindSymbol( const std::string &symbol )
29 {
30    DynamicLibraryManager::Symbol L_symaddr = 0;
31    if ( ::shl_findsym( (shl_t*)(&m_libraryHandle), 
32                        symbol.c_str(), 
33                        TYPE_UNDEFINED, 
34                        &L_symaddr ) == 0 )
35    {
36       return L_symaddr;
37    } 
38
39    return 0;
40 }
41
42
43 std::string 
44 DynamicLibraryManager::getLastErrorDetail() const
45 {
46   return "";
47 }
48
49
50 CPPUNIT_NS_END
51
52
53 #endif // defined(CPPUNIT_HAVE_UNIX_SHL_LOADER)