45 TRACE_DEBUG(
"Loading Module: " + strModuleName);
48 THROW_ERROR(Std_Err_lModuleNameIsBlank, Std_Err_strModuleNameIsBlank);
52 hMod = LoadLibrary(strModuleName.c_str());
58 int iError = GetLastError();
59 THROW_PARAM_ERROR(Std_Err_lModuleNotLoaded, Std_Err_strModuleNotLoaded,
"Module", strModuleName +
", Last Error: " + STR(iError));
66 GetClassFactory lpFactoryFunc = NULL;
68 TRACE_DEBUG(
" Gettting the classfactory pointer.");
70 lpFactoryFunc = (GetClassFactory) GetProcAddress(hMod,
"GetStdClassFactory");
75 THROW_PARAM_ERROR(Std_Err_lModuleProcNotLoaded, Std_Err_strModuleProcNotLoaded,
"Module", strModuleName);
80 TRACE_DEBUG(
"Finished Loading Module: " + strModuleName);
81 return lpFactoryFunc();
97 TRACE_DEBUG(
"Loading Module: " + strModuleName);
100 THROW_ERROR(Std_Err_lModuleNameIsBlank, Std_Err_strModuleNameIsBlank);
103 std::string strModRenamed = strModuleName;
106 strModRenamed =
"lib" +
Std_Replace(strModuleName,
".dll",
".so");
107 strModRenamed =
Std_Replace(strModRenamed,
"VC10",
"vc10");
112 hMod = dlopen(strModRenamed.c_str(), RTLD_LAZY);
118 std::string strError = strModRenamed +
", Last Error: " + dlerror();
119 THROW_PARAM_ERROR(Std_Err_lModuleNotLoaded, Std_Err_strModuleNotLoaded,
"Module", strError);
125 GetClassFactory lpFactoryFunc = NULL;
127 TRACE_DEBUG(
" Gettting the classfactory pointer.");
129 lpFactoryFunc = (GetClassFactory) dlsym(hMod,
"GetStdClassFactory");
131 if(!lpFactoryFunc || dlerror() != NULL)
134 THROW_PARAM_ERROR(Std_Err_lModuleProcNotLoaded, Std_Err_strModuleProcNotLoaded,
"Module", strModRenamed +
", Last Error: " + dlerror());
139 TRACE_DEBUG(
"Finished Loading Module: " + strModRenamed);
142 TRACE_DEBUG(
"Returning class factory: " + strModRenamed);
virtual ~IStdClassFactory()
Destructor.
Namespace for the standard utility objects.
std::string Std_ToLower(std::string strVal)
Converts a string to lower case.
bool Std_IsBlank(std::string strVal)
Trims a string and tests if a string is blank.
IStdClassFactory()
Default constructor.
std::string Std_Replace(std::string strVal, std::string strFind, std::string strReplace)
Replaces a substring with another string.
static IStdClassFactory * LoadModule(std::string strModuleName, bool bThrowError=true)
Loads a DLL module by name and attempts to call the GetStdClassFactory method to get a pointer to the...