|
Gaudi Framework, version v22r1 |
| Home | Generated: Mon Feb 28 2011 |
#include <string>#include <iostream>#include <dlfcn.h>#include <unistd.h>#include <vector>#include <algorithm>
Go to the source code of this file.
Defines | |
| #define | GETPROC(h, x) ::dlsym ( h, #x ) |
Functions | |
| void * | LOAD_LIB (const char *x) |
| int | main (int argc, char **argv) |
| #define GETPROC | ( | h, | |
| x | |||
| ) | ::dlsym ( h, #x ) |
Definition at line 21 of file GaudiTestMain.cpp.
| void* LOAD_LIB | ( | const char * | x ) |
Definition at line 16 of file GaudiTestMain.cpp.
{
std::string l = "lib"; l+=x; l+=".so";
return ::dlopen( l.c_str() , RTLD_NOW|RTLD_GLOBAL);
//return ::dlopen( l.c_str() , RTLD_NOW);
}
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Definition at line 26 of file GaudiTestMain.cpp.
{
if ( argc < 2 ) {
std::cout << "Usage: main.exe <example library> arg [arg [arg]]" << std::endl;
}
else {
typedef long (*func)(int, char**);
// LOAD_LIB("GaudiPoolDb.dll");
void* handle = LOAD_LIB( argv[1] );
if ( 0 != handle ) {
func fun = (func)GETPROC(handle, ExampleMain );
if ( fun ) {
return (*fun)(argc, argv);
}
std::cout << "Failed to access test procedure ExampleMain" << std::endl;
return 0;
}
std::cout << "Failed to load test library:" << argv[1] << std::endl;
#ifdef WIN32
#else
std::cout << "Error:" << ::dlerror() << std::endl;
#endif
}
return 0;
}