# PDynaLink Class Reference

A dynamic link library. More...

`#include <dynalink.h>`

Inheritance diagram for PDynaLink:

List of all members.

## DLL entry point functions

typedef void(*) | Function ()
| Primitive pointer to a function for a dynamic link module.
PBoolean | GetFunction (PINDEX index, Function &func)
| Get a pointer to the function in the dynamically loadable module.
PBoolean | GetFunction (const PString &name, Function &func)
| Get a pointer to the function in the dynamically loadable module. Return OS error code for last operation.
const PString & | GetLastError () const

## Load/Unload function

virtual PBoolean | Open (const PString &name)
virtual void | Close ()
| Close the dyna-link library.
virtual PBoolean | IsLoaded () const
| Dyna-link module is loaded and may be accessed.
virtual PString | GetName (PBoolean full=false) const
| Get the name of the loaded library.
static PString | GetExtension ()
| Get the extension used by this platform for dynamic link libraries.

## Public Member Functions

Construction
| PDynaLink ()
| Create a new dyna-link, loading the specified module.
| PDynaLink (const PString &name)
| Create a new dyna-link, loading the specified module.
| ~PDynaLink ()
| Destroy the dyna-link, freeing the module.

## Protected Attributes

PString | m_lastError
void * | dllHandle
PString | name

## Detailed Description

A dynamic link library.

This allows the loading at run time of code modules for use by an application. MacOS X/darwin supports plugins linked as object file image (linked with the -bundle arg to ld) or dynamic libraries (-dynamic). On all Unix platforms the file name should end in ".so". On Windows the filename should end in ".dll"

## Member Typedef Documentation

typedef void(*) PDynaLink::Function()

Primitive pointer to a function for a dynamic link module.

## Constructor & Destructor Documentation

PDynaLink::PDynaLink | ( |  | ) |

Create a new dyna-link, loading the specified module.

The first, parameterless, form does load a library.

PDynaLink::PDynaLink | ( | const PString & | name | ) |

Create a new dyna-link, loading the specified module.

The first, parameterless, form does load a library.

Parameters:

  name | Name of the dynamically loadable module.

PDynaLink::~PDynaLink | ( |  | ) |

Destroy the dyna-link, freeing the module.

## Member Function Documentation

virtual void PDynaLink::Close | ( |  | ) | `[virtual]`

Close the dyna-link library.

static PString PDynaLink::GetExtension | ( |  | ) | `[static]`

Get the extension used by this platform for dynamic link libraries.

Returns:
  String for file extension.

PBoolean PDynaLink::GetFunction | ( | const PString & | name,
|  | Function & | func |
| ) |  |  |

Get a pointer to the function in the dynamically loadable module. Return OS error code for last operation.

Returns:
  true if function was found.

Parameters:

  name | Name of the function to get.
  func | Refrence to point to function to get.

PBoolean PDynaLink::GetFunction | ( | PINDEX | index,
|  | Function & | func |
| ) |  |  |

Get a pointer to the function in the dynamically loadable module.

Returns:
  true if function was found.

Parameters:

  index | Ordinal number of the function to get.
  func | Refrence to point to function to get.

const PString& PDynaLink::GetLastError | ( |  | ) | const`[inline]`

virtual PString PDynaLink::GetName | ( | PBoolean | full = `false` | ) | const`[virtual]`

Get the name of the loaded library.

If the library is not loaded this may return an empty string.

If `full` is true then the full pathname of the library is returned otherwise only the name part is returned.

Returns:
  String for the library name.

Parameters:

  full | Flag for full or short path name

virtual PBoolean PDynaLink::IsLoaded | ( |  | ) | const`[virtual]`

Dyna-link module is loaded and may be accessed.

virtual PBoolean PDynaLink::Open | ( | const PString & | name | ) | `[virtual]`

Parameters:

  name | Name of the dynamically loadable module.

## Member Data Documentation

void* PDynaLink::dllHandle `[protected]`

PString PDynaLink::m_lastError `[protected]`

PString PDynaLink::name `[protected]`

The documentation for this class was generated from the following file:

- dynalink.h