| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

Defines | Functions | Variables

# System.cpp File Reference

`#include <ctime>`
`#include <cstring>`
`#include <cstdlib>`
`#include <iomanip>`
`#include <iostream>`
`#include <sstream>`
`#include <typeinfo>`
`#include "GaudiKernel/System.h"`
`#include <errno.h>`
`#include <string.h>`
`#include "sys/times.h"`
`#include "unistd.h"`
`#include "libgen.h"`
`#include <cstdio>`
`#include <cxxabi.h>`
Include dependency graph for System.cpp:

Go to the source code of this file.

## Defines
#define | SYSTEM_SYSTEM_CPP
#define | __attribute__(x)
## Functions
static unsigned long | doLoad (const std::string &name, System::ImageHandle *handle)
static unsigned long | loadWithoutEnvironment (const std::string &name, System::ImageHandle *handle)
## Variables
static const char * | SHLIB_SUFFIX = ".so"
static std::vector< std::string > | s_argvStrings
static std::vector< const char * > | s_argvChars

## Define Documentation

#define __attribute__ | ( |  | x ) |

Definition at line 69 of file System.cpp.

#define SYSTEM_SYSTEM_CPP

Definition at line 14 of file System.cpp.

## Function Documentation

static unsigned long doLoad | ( | const std::string & | name,
|  | System::ImageHandle * | handle
| ) |  | `[static]`

Definition at line 75 of file System.cpp.

                                                                                   {
    #ifdef _WIN32
      void* mh = ::LoadLibrary( name.length() == 0 ? System::exeName().c_str() : name.c_str());
      *handle = mh;
    #else
      const char* path = name.c_str();
    #if defined(linux) || defined(__APPLE__)
      void *mh = ::dlopen(name.length() == 0 ? 0 : path, RTLD_LAZY | RTLD_GLOBAL);
      *handle = mh;
    #elif __hpux
      shl_t mh = ::shl_load(name.length() == 0 ? 0 : path, BIND_IMMEDIATE | BIND_VERBOSE, 0);
      HMODULE* mod = new HMODULE;
      if ( 0 != mh ) {
        if ( 0 != ::shl_gethandle_r(mh, &mod->dsc) ) {
          std::cout << "System::loadDynamicLib>" << ::strerror(getLastError()) << std::endl;
        }
        else {
          typedef void* (*___all)();
          ___all _alloc = (___all)malloc;
          mod->numSym = ::shl_getsymbols(mod->dsc.handle, TYPE_PROCEDURE, EXPORT_SYMBOLS, malloc, &mod->sym);
          *handle = mod;
        }
      }
    #endif
    #endif
      if ( 0 == *handle )   {
        return System::getLastError();
      }
      return 1;
    }

static unsigned long loadWithoutEnvironment | ( | const std::string & | name,
|  | System::ImageHandle * | handle
| ) |  | `[static]`

Definition at line 106 of file System.cpp.

                                                                                                     {

      std::string dllName = name;
      long len = strlen(SHLIB_SUFFIX);

      // Add the suffix at the end of the library name only if necessary
      // FIXME: cure the logic
      if ((dllName.length() != 0) &&
          ::strncasecmp(dllName.data()+dllName.length()-len, SHLIB_SUFFIX, len) != 0) {
        dllName += SHLIB_SUFFIX;
      }

      // Load the library
      return doLoad(dllName, handle);
    }

## Variable Documentation

std::vector<const char*> s_argvChars`[static]`

Definition at line 73 of file System.cpp.

std::vector<std::string> s_argvStrings`[static]`

Definition at line 72 of file System.cpp.

const char* SHLIB_SUFFIX = ".so"`[static]`

Definition at line 37 of file System.cpp.

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