Gaudi Framework, version v22r0

Home   Generated: 9 Feb 2011

GaudiTestMain.cpp File Reference

#include <string>
#include <iostream>
#include <dlfcn.h>
#include <unistd.h>
#include <vector>
#include <algorithm>
Include dependency graph for GaudiTestMain.cpp:

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 Documentation

#define GETPROC ( h,
 )     ::dlsym ( h, #x )

Definition at line 21 of file GaudiTestMain.cpp.


Function Documentation

void* LOAD_LIB ( const char *  x  ) 

Definition at line 16 of file GaudiTestMain.cpp.

00016                                  {
00017     std::string l = "lib"; l+=x; l+=".so";
00018     return ::dlopen( l.c_str() , RTLD_NOW|RTLD_GLOBAL);
00019     //return ::dlopen( l.c_str() , RTLD_NOW);
00020   }

int main ( int  argc,
char **  argv 
)

Definition at line 26 of file GaudiTestMain.cpp.

00026                                   {
00027   if ( argc < 2 )  {
00028     std::cout << "Usage: main.exe <example library> arg [arg [arg]]" << std::endl;
00029   }
00030   else  {
00031     typedef long (*func)(int, char**);
00032     // LOAD_LIB("GaudiPoolDb.dll");
00033     void* handle = LOAD_LIB( argv[1] );
00034     if ( 0 != handle )  {
00035       func fun = (func)GETPROC(handle, ExampleMain );
00036       if ( fun ) {
00037         return (*fun)(argc, argv);
00038       }
00039       std::cout << "Failed to access test procedure ExampleMain" << std::endl;
00040       return 0;
00041     }
00042     std::cout << "Failed to load test library:" << argv[1] << std::endl;
00043 #ifdef WIN32
00044 #else
00045     std::cout << "Error:" << ::dlerror() << std::endl;
00046 #endif
00047   }
00048   return 0;
00049 }

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Wed Feb 9 16:28:27 2011 for Gaudi Framework, version v22r0 by Doxygen version 1.6.2 written by Dimitri van Heesch, © 1997-2004