#include <symbol.h>
Inheritance diagram for ModuleFunction< FPTR >:
Public Member Functions | |
ModuleFunction () | |
Create a NULL function pointer:. | |
ModuleFunction (const ModuleSymbol &s) | |
Create a module function pointer from a module symbol:. | |
ModuleFunction (const ModuleFunction &mf) | |
Copy constructor as usual. | |
~ModuleFunction () | |
FPTR | fptr () const |
Get the function pointer casted properly (just like ptr()):. | |
FPTR | operator * () const |
Get the function pointer casted properly; just like fptr(). |
Hence, it is only "wrapping some casting candy around ModuleSymbol" to avoid using casts all the time and enable you to easily put it into structures like
struct MyModuleMethods { ModuleFunction<int(*)(double)> double_to_int; ModuleFunction<char*(*)()> get_version_string; };
Just assign the ModuleSymbol returned by SharedObject::lookup() to the corresponding ModuleFunction<>; these can then called easily:
MyModuleMethods mmm; int rv = *(mmm.double_to_int)( 3.14 ); printf("%s", *(mmm.get_version_string)() );
This is a completely "C++-safe" type (assignment & copy constructor).
See the docu for file pool.h for detailed information.
Definition at line 103 of file symbol.h.
|
Create a NULL function pointer:.
|
|
Create a module function pointer from a module symbol:.
|
|
Copy constructor as usual.
|
|
|
|
Get the function pointer casted properly (just like ptr()):.
Definition at line 115 of file symbol.h. References ModuleSymbol::ptr(). Referenced by ModuleFunction< FPTR >::operator *(). |
|
Get the function pointer casted properly; just like fptr().
Definition at line 118 of file symbol.h. References ModuleFunction< FPTR >::fptr(). |