BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcPatRec/TrkBase/test/test.cxx
Go to the documentation of this file.
1#include <dlfcn.h>
2#include <iostream>
3
4int main() {
5 using std::cerr;
6 using std::cout;
7
8 cout << "C++ dlopen demo\n\n";
9
10 // open the library
11 cout << "Opening TrkBase.so...\n";
12 void* handle = dlopen( "../rh73_gcc32/libTrkBase.so", RTLD_LAZY );
13
14 if ( !handle )
15 {
16 cerr << "Cannot open library: " << dlerror() << '\n';
17 return 1;
18 }
19
20 /* // load the symbol
21 cout << "Loading symbol hello...\n";
22 typedef void (*hello_t)();
23 hello_t hello = (hello_t) dlsym(handle, "hello");
24 if (!hello) {
25 cerr << "Cannot load symbol 'hello': " << dlerror() <<
26 '\n';
27 dlclose(handle);
28 return 1;
29 }
30
31 // use it to do the calculation
32 cout << "Calling hello...\n";
33 hello();
34 */
35 // close the library
36 cout << "Closing library...\n";
37 dlclose( handle );
38}