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

MCLibrary Class Reference

Representation of a dynamically loaded library. More...

#include <mcllib/MCLibrary.h>

Inheritance diagram for MCLibrary:

MCBase List of all members.

Public Member Functions

MCLibrarySym find (const MCString &symbol, bool isFunction)
 Find a symbol in the library.
const MCStringgetName () const
 Get the library name as used at construction.
 MCLibrary (const MCString &libName)
 Construct from a dynamic library file.
 MCLibrary ()
 Default constructor.

Detailed Description

Representation of a dynamically loaded library.

Symbols within the library can be accessed using the find() method. When a library is loaded the MCLibMain() function is called (if it exists in the library) with the parameter true, to indicate that the library is being loaded. When the library is unloaded (at destruction time), the MCLibMain() function is called with the parameter false to indicate that the library is being unloaded.

Example

 MCL_EXPORT void MCLibMain(bool load)
 {
         if (!load)
            return;
        // make sure that events used by the library exist
        MCEvent::registerEvent("myEvent.mydomain.com");
 }
 


Constructor & Destructor Documentation

MCLibrary  ) 
 

Default constructor.

Attempts to use find() on a library object created using the default constructor will cause an exception to be thrown.

MCLibrary const MCString libName  ) 
 

Construct from a dynamic library file.

Parameters:
libName the name of the dynamic library to construct from. If the dynamic library refered to by libName cannot be loaded and linked into the application an exception will be thrown.


Member Function Documentation

MCLibrarySym find const MCString symbol,
bool  isFunction
 

Find a symbol in the library.

If the symbol does not exist in the library an exception will be thrown. On systems which distinguish between function and non-function symbols, the application must set isFunction to true to load function symbols and false to load non-function symbols, otherwise the corresponding symbol cannot be loaded. On other systems (in particular, unix and windows) symbols can be loaded whether or not isFunction matches the type of symbol. On all systems, isFunction determines the result of calls to the isFunction() method on the returned MCLibrarySym.

Parameters:
symbol the symbol to load from the library
isFunction set to true if the symbol represents a function. On most systems this is advisory but affects whether isFunction() on the returned symbol is true.
Returns:
an MCLibrarySym representing the symbol

const MCString& getName  )  const
 

Get the library name as used at construction.

Returns:
the name of the library passed at construction time.


Generated on Wed Jan 12 19:05:49 2005 for MCLLIB by  doxygen 1.3.9.1