Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::Library Class Reference

A Library represents a DLL (Dynamic Linked Library) or SO (Shared Object). More...

#include <vcf/FoundationKit/Library.h>

Inheritance diagram for VCF::Library:

VCF::Object List of all members.

Public Member Functions

 Library (const String &libraryName="", const bool &autoUnloadLib=false)
virtual ~Library ()
void load (const String &libraryFilename)
 Dynamically loads the DLL/SO specified by the libraryFilename argument.
void unload ()
 unloads the DLL/SO
void * getFunction (const String &functionName)
 returns an exported function of the library
void init ()
 initializes the library object

Detailed Description

A Library represents a DLL (Dynamic Linked Library) or SO (Shared Object).

It can be created by passing in a fully qualified file name to the constructor. The specified DLL/SO will then be dynamically loaded (and unloaded when the Library obejct is destroyed if autoUnloadLib is true). Alternatively you may call the load() method which will do the same.


Constructor & Destructor Documentation

VCF::Library::Library const String libraryName = "",
const bool &  autoUnloadLib = false
 

virtual VCF::Library::~Library  )  [virtual]
 


Member Function Documentation

void* VCF::Library::getFunction const String functionName  ) 
 

returns an exported function of the library

Parameters:
String the name of the function to return
Returns:
void* a void pointer to the exported function. Callers are responsible for actually typecasting this to a meaningful function pointer. For example:
        typedef int (MyFunctionPtr)( int, bool);
        ... //more code
        MyFunctionPtr funcPtr = (MyFunctionPtr) lib->getFunction( "DummyFunction" );
        int res = funcPtr( 12, true );
if the function does not exist then the method returns null

void VCF::Library::init  ) 
 

initializes the library object

void VCF::Library::load const String libraryFilename  ) 
 

Dynamically loads the DLL/SO specified by the libraryFilename argument.

The default behaviour is to just load the library, assuming the libraryFilename is a path to the library. However, we are now going to get a tad fancier! If the libraryFilename is a directory, then we will try and locate the Info.plist/Info.xml file, read it, and, based on the info we get, attempt to use this to open the library inside.

Parameters:
String the fully qualified file name of the DLL or SO to load, or a directory that includes a Info.plist/Info.xml file in it identifying the library's ProgramInfo.
See also:
System::getProgramInfoFromFileName()

ProgramInfo

void VCF::Library::unload  ) 
 

unloads the DLL/SO


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information