typedef struct
{
- std::wstring wstLibraryName; /** name of dynamic library **/
+ wchar_t* pwstLibraryName; /** name of dynamic library **/
DynLibHandle hLib; /** handle of the library **/
} DynamicLibraryStr;
typedef struct
{
- std::wstring wstEntryPointName; /** name of interface **/
+ wchar_t* pwstEntryPointName; /** name of interface **/
int iLibIndex; /** name of interface **/
dynlib_ptr functionPtr; /** entrypoint for the interface **/
bool bOK; /** flag set to TRUE if entrypoint can be used **/
public :
/* tools fucntions */
- static void setLibraryName(DynamicLibraryStr* _pDynamicLibrary, const std::wstring& _wstLibraryName);
- static void setEntryPointName(EntryPointStr* _pEntryPoint, const std::wstring& _wstEntryPointName);
+ static void setLibraryName(DynamicLibraryStr* _pDynamicLibrary, wchar_t* _pwstLibraryName);
+ static void setEntryPointName(EntryPointStr* _pEntryPoint, wchar_t* _pwstEntryPointName);
/* "Constructors" */
static DynamicLibraryStr* getNewDynamicLibraryStr();
static std::list<EntryPointStr*>* getEntryPointList();
static void addEntryPoint(EntryPointStr* _pEP);
static void removeEntryPoint(int _iEntryPointIndex);
- static EntryPointStr* getEntryPoint(const std::wstring& _wstEntryPointName, int _iDynamicLibraryIndex = -1);
- static int getEntryPointPosition(const std::wstring& _wstEntryPointName, int _iDynamicLibraryIndex = -1);
+ static EntryPointStr* getEntryPoint(wchar_t* _pwstEntryPointName, int _iDynamicLibraryIndex = -1);
+ static int getEntryPointPosition(wchar_t* _pwstEntryPointName, int _iDynamicLibraryIndex = -1);
static dynlib_ptr getEntryPointFromPosition(int position);
static std::vector<std::wstring> getEntryPointNameList();
ConfigVariable::DynamicLibraryStr* ConfigVariable::getNewDynamicLibraryStr()
{
DynamicLibraryStr* pDL = (DynamicLibraryStr*)MALLOC(sizeof(DynamicLibraryStr));
- pDL->wstLibraryName = L"";
+ pDL->pwstLibraryName = NULL;
pDL->hLib = 0;
return pDL;
}
pEP->bOK = false;
pEP->functionPtr = NULL;
pEP->iLibIndex = -1;
- pEP->wstEntryPointName = L"";
+ pEP->pwstEntryPointName = NULL;
return pEP;
}
-void ConfigVariable::setLibraryName(ConfigVariable::DynamicLibraryStr* _pDynamicLibrary, const std::wstring& _wstLibraryName)
+void ConfigVariable::setLibraryName(ConfigVariable::DynamicLibraryStr* _pDynamicLibrary, wchar_t* _pwstLibraryName)
{
if (_pDynamicLibrary)
{
- _pDynamicLibrary->wstLibraryName = _wstLibraryName;
+ if (_pDynamicLibrary->pwstLibraryName)
+ {
+ FREE(_pDynamicLibrary->pwstLibraryName);
+ }
+ _pDynamicLibrary->pwstLibraryName = os_wcsdup(_pwstLibraryName);
}
}
-void ConfigVariable::setEntryPointName(ConfigVariable::EntryPointStr* _pEntryPoint, const std::wstring& _wstEntryPointName)
+void ConfigVariable::setEntryPointName(ConfigVariable::EntryPointStr* _pEntryPoint, wchar_t* _pwstEntryPointName)
{
if (_pEntryPoint)
{
- _pEntryPoint->wstEntryPointName = _wstEntryPointName;
+ if (_pEntryPoint->pwstEntryPointName)
+ {
+ FREE(_pEntryPoint->pwstEntryPointName);
+ }
+ _pEntryPoint->pwstEntryPointName = os_wcsdup(_pwstEntryPointName);;
}
}
{
EntryPointStr* pEP = *it;
m_EntryPointList.remove(*it);
+ FREE(pEP->pwstEntryPointName);
delete pEP;
if (m_EntryPointList.size() == 0)
{
}
}
//remove dynamic library
+ FREE(m_DynLibList[_iDynamicLibraryIndex]->pwstLibraryName);
delete m_DynLibList[_iDynamicLibraryIndex];
m_DynLibList[_iDynamicLibraryIndex] = NULL;
}
}
}
-ConfigVariable::EntryPointStr* ConfigVariable::getEntryPoint(const std::wstring& _wstEntryPointName, int _iDynamicLibraryIndex)
+ConfigVariable::EntryPointStr* ConfigVariable::getEntryPoint(wchar_t* _pwstEntryPointName, int _iDynamicLibraryIndex)
{
std::list<EntryPointStr*>::const_iterator it;
for (it = m_EntryPointList.begin() ; it != m_EntryPointList.end() ; it++)
//by pass iLibIndex check if _iDynamicLibraryIndex == -1
if (_iDynamicLibraryIndex == -1 || (*it)->iLibIndex == _iDynamicLibraryIndex)
{
- if ((*it)->wstEntryPointName == _wstEntryPointName)
+ if (wcscmp((*it)->pwstEntryPointName, _pwstEntryPointName) == 0)
{
return *it;
}
return NULL;
}
-int ConfigVariable::getEntryPointPosition(const std::wstring& _wstEntryPointName, int _iDynamicLibraryIndex)
+int ConfigVariable::getEntryPointPosition(wchar_t* _pwstEntryPointName, int _iDynamicLibraryIndex)
{
int pos = 0;
std::list<EntryPointStr*>::const_iterator it;
//by pass iLibIndex check if _iDynamicLibraryIndex == -1
if (_iDynamicLibraryIndex == -1 || (*it)->iLibIndex == _iDynamicLibraryIndex)
{
- if ((*it)->wstEntryPointName == _wstEntryPointName)
+ if (wcscmp((*it)->pwstEntryPointName, _pwstEntryPointName) == 0)
{
return pos;
}
std::list<EntryPointStr*>::const_iterator it;
for (it = m_EntryPointList.begin() ; it != m_EntryPointList.end() ; it++)
{
- EntryPointNames.push_back((*it)->wstEntryPointName);
+ EntryPointNames.push_back((*it)->pwstEntryPointName);
}
return EntryPointNames;
}