| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# 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,
|  | x |  | ) | ::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 }