BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcPatRec/TrkBase/TrkBase-00-01-12/test/test.cxx
Go to the documentation of this file.
1#include <iostream>
2#include <dlfcn.h>
3
4
5int main() {
6 using std::cout;
7 using std::cerr;
8
9 cout << "C++ dlopen demo\n\n";
10
11 // open the library
12 cout << "Opening TrkBase.so...\n";
13 void* handle = dlopen("../rh73_gcc32/libTrkBase.so", RTLD_LAZY);
14
15 if (!handle) {
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}
39