Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

P::SharedLib Class Reference
[Core library]

Shared library loader. More...

#include <psharedlib.h>

List of all members.

Public Types

enum  ldmode_t { bindNow, bindLazy }
 Function binding mode. More...


Public Member Functions

 SharedLib (const std::string &path, ldmode_t mode=bindLazy) throw (SystemError)
 Constructor.

 ~SharedLib () throw ()
 Destructor.

void * operator[] (const char *symbol) throw ()
 Resolve symbol from shared library.


Detailed Description

Shared library loader.

A class that can be used to dynamically load shared libraries to resolve symbols from it. The example below shows how to retrieve the address of the cos function in the math library:

SharedLib shl("libm.so");
double (*cosine)(double);
cosine = shl["cos"];
(*cosine)(2.0);
Author:
Christian Prochnow <cproch@seculogix.de>

Definition at line 43 of file psharedlib.h.


Member Enumeration Documentation

enum P::SharedLib::ldmode_t
 

Function binding mode.

Enumeration values:
bindNow  Bind now
bindLazy  Bind lazy (on first call)

Definition at line 46 of file psharedlib.h.


Constructor & Destructor Documentation

P::SharedLib::SharedLib const std::string &  path,
ldmode_t  mode = bindLazy
throw (SystemError)
 

Constructor.

Constructs the object and loads the shared library specified in the path argument.

Parameters:
path the path to the shared library
mode enum specifying the mode when loading the shlib
Exceptions:
SystemError 

P::SharedLib::~SharedLib  )  throw ()
 

Destructor.

The destructor unloads the shared library from memory.


Member Function Documentation

void* P::SharedLib::operator[] const char *  symbol  )  throw ()
 

Resolve symbol from shared library.

Resolves a symbol from the shared library and returns a pointer to the symbol.

Returns:
the address of the symbol or NULL if it was not found


The documentation for this class was generated from the following file:
Generated on Fri Mar 12 21:08:36 2004 for P::Classes by doxygen 1.3.3