Public Member Functions

CdcDynamicLibrary Class Reference

This class is a wrapper that loads functions from dll/sa (dynamic library). More...

#include <DcDynamicLibrary.h>

List of all members.

Public Member Functions

 CdcDynamicLibrary (const CdcString &name)
 Constructor - Loads the library.
 ~CdcDynamicLibrary ()
 Destructor - Frees the library.
void * GetFunctionByName (const CdcString &func_name)
 Returns a pointer to a function in the library.
bool IsLoaded ()
 Returns True if the library is loaded.
CdcString GetLastError ()
 Return the last error message, or an empty string.
CdcString GetLibraryName ()
 Return the dynamic library name.

Detailed Description

This class is a wrapper that loads functions from dll/sa (dynamic library).

It loads the library in the Constructor, and frees it in the Destructor.

Author:
Erez Bibi
Version:
1.0

Definition at line 34 of file DcDynamicLibrary.h.


Constructor & Destructor Documentation

CdcDynamicLibrary::CdcDynamicLibrary ( const CdcString name )

Constructor - Loads the library.

DcDynamicLibrary.cpp: implementation of the CdcDynamicLibrary class.

Parameters:
nameThe library name (and path).

for documentation see the header file.

Definition at line 28 of file DcDynamicLibrary.cpp.

CdcDynamicLibrary::~CdcDynamicLibrary (  )

Destructor - Frees the library.

Definition at line 37 of file DcDynamicLibrary.cpp.


Member Function Documentation

void * CdcDynamicLibrary::GetFunctionByName ( const CdcString func_name )

Returns a pointer to a function in the library.

It access the function by it's name. The caller must cast this pointer to the function pointer! If the function cannot be found in the library, or if the library cannot be loaded, GetFunctionByName will return NULL. The error message can be retrieved from GetLastError

Parameters:
func_nameThe name of the function in the library.
Returns:
(void*) A pointer to this function as pointer to void.

Definition at line 43 of file DcDynamicLibrary.cpp.

CdcString CdcDynamicLibrary::GetLastError (  ) [inline]

Return the last error message, or an empty string.

Definition at line 76 of file DcDynamicLibrary.h.

CdcString CdcDynamicLibrary::GetLibraryName (  ) [inline]

Return the dynamic library name.

Definition at line 82 of file DcDynamicLibrary.h.

bool CdcDynamicLibrary::IsLoaded (  ) [inline]

Returns True if the library is loaded.

Definition at line 70 of file DcDynamicLibrary.h.


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