00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "mxfunction.h"
00016
00017
00018
00019 namespace mx
00020 {
00021
00022 mxShared::mxShared(std::string module)
00023 {
00024 ptr = 0;
00025
00026 if(module.length()>0)
00027 loadModule(module);
00028
00029 }
00030
00031
00032 mxShared::~mxShared()
00033 {
00034
00035 unloadModule();
00036
00037 }
00038
00039 bool mxShared::loadModule(std::string module)
00040 {
00041
00042 ptr = SDL_LoadObject(module.c_str());
00043 if(ptr == 0) return false;
00044
00045 return true;
00046 }
00047
00048
00049 bool mxShared::unloadModule()
00050 {
00051
00052 if(ptr != 0)
00053 SDL_UnloadObject(ptr);
00054
00055 ptr = 0;
00056
00057 return true;
00058 }
00059
00060 void *mxShared::loadFunction(std::string name)
00061 {
00062
00063 if(ptr == 0) return 0;
00064
00065 return SDL_LoadFunction(ptr, name.c_str());
00066
00067 }
00068
00069
00070 }
00071