Gaudi Framework, version v22r1

Home   Generated: Mon Feb 28 2011
Defines | Functions

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.

                                 {
    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;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Mon Feb 28 2011 18:27:43 for Gaudi Framework, version v22r1 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004