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