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

MCLibrarySym Class Reference

Representation of a symbol obtained from a dynamically loaded library. More...

#include <mcllib/MCLibrary.h>

Inheritance diagram for MCLibrarySym:

MCBase List of all members.

Public Types

typedef void * MCAnySym
 Generic type of a non-function symbol.
typedef void(* MCFuncSym )()
 Generic type of a function symbol.

Public Member Functions

const MCStringgetName () const
 Get the name of the symbol.
bool isFunction () const
 Test to see if the symbol refers to a function.
 operator MCAnySym () const
 Obtain the symbol as a pointer to a variable.
 operator MCFuncSym () const
 Obtain the symbol as a function pointer.

Friends

class mclpriv::LibraryImpl

Detailed Description

Representation of a symbol obtained from a dynamically loaded library.

Symbols maintain a reference to the library from which they were loaded so that the library does not get unloaded if symbols are still in use. For this to work, the MCLibrarySym objects must not go out of scope whilst the symbol reference they contain is still in use. Library symbols are obtained from a library (MCLibrary) using the find() member function.


Member Typedef Documentation

typedef void* MCAnySym
 

Generic type of a non-function symbol.

Cast to the appropriate type.

typedef void(* MCFuncSym)()
 

Generic type of a function symbol.

Cast to the appropriate type.


Member Function Documentation

const MCString& getName  )  const
 

Get the name of the symbol.

Returns:
the name of the symbol

bool isFunction  )  const
 

Test to see if the symbol refers to a function.

Returns:
true if the symbol object represents a function.

operator MCAnySym  )  const
 

Obtain the symbol as a pointer to a variable.

This must be recast to the appropriate type. The function will throw if the symbol does represent a function. The returned value is invalid once the MCLibrarySym has gone out of scope. Accessing the value after this point may cause the application to crash.

Returns:
a generic pointer which must be recast to the appropriate type.

operator MCFuncSym  )  const
 

Obtain the symbol as a function pointer.

This must be recast to the appropriate type. The function will throw if the symbol does not represent a function. The returned value is invalid once the MCLibrarySym has gone out of scope. Accessing the function after this point may cause the application to crash.

Returns:
a generic function pointer which must be recast to the appropriate type.


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