mx::mxShared Class Reference

List of all members.

Public Member Functions

 mxShared (std::string module_name="")
 ~mxShared ()
bool loadModule (std::string name)
bool unloadModule ()
void * loadFunction (std::string name)

Protected Attributes

void * ptr


Detailed Description

loading shared modules

Definition at line 31 of file mxfunction.h.


Constructor & Destructor Documentation

mx::mxShared::mxShared ( std::string  module_name = ""  ) 

default constructor for class

Parameters:
module_name module to load, .so, .dll, .dylib

Definition at line 22 of file mxfunction.cpp.

References loadModule().

00023         {
00024                 ptr = 0;
00025 
00026                 if(module.length()>0)
00027                         loadModule(module);
00028 
00029         }

mx::mxShared::~mxShared (  ) 

destructor

Definition at line 32 of file mxfunction.cpp.

References unloadModule().

00033         {
00034 
00035                 unloadModule();
00036 
00037         }


Member Function Documentation

void * mx::mxShared::loadFunction ( std::string  name  ) 

load a function by function name id

Parameters:
name function name
Returns:
function pointer for function zero if not found or error

Definition at line 60 of file mxfunction.cpp.

00061         {
00062 
00063                 if(ptr == 0) return 0;
00064 
00065                 return SDL_LoadFunction(ptr, name.c_str());
00066 
00067         }

bool mx::mxShared::loadModule ( std::string  name  ) 

load a module by filename

Parameters:
name filename of module to load
Returns:
true if successful

Definition at line 39 of file mxfunction.cpp.

Referenced by mxShared().

00040         {
00041 
00042                 ptr = SDL_LoadObject(module.c_str());
00043                 if(ptr == 0) return false;
00044 
00045                 return true;
00046         }

bool mx::mxShared::unloadModule (  ) 

unload a module

Returns:
true if successful

Definition at line 49 of file mxfunction.cpp.

Referenced by ~mxShared().

00050         {
00051 
00052                 if(ptr != 0)
00053                         SDL_UnloadObject(ptr);
00054 
00055                 ptr = 0;
00056 
00057                 return true;
00058         }


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

Generated on Wed Jun 10 14:52:02 2009 for libmx by  doxygen 1.5.8