动态加载dll改为绝对路径
This commit is contained in:
parent
c6242a99ed
commit
efffae7369
|
@ -61,20 +61,17 @@ HGResult HGPdfReaderImpl::Open(const HGChar* fileName)
|
|||
|
||||
assert(NULL == m_dll);
|
||||
|
||||
HGChar oldDir[256];
|
||||
HGBase_GetCurrentDir(oldDir, 256);
|
||||
HGChar moduleName[256];
|
||||
HGBase_GetModuleName(union_cast<void*>(&HGPdfReaderImpl::Open), moduleName, 256);
|
||||
HGChar newDir[256];
|
||||
HGBase_GetFilePath(moduleName, newDir, 256);
|
||||
HGChar dllPath[256];
|
||||
HGBase_GetFilePath(moduleName, dllPath, 256);
|
||||
|
||||
HGBase_SetCurrentDir(newDir);
|
||||
#if defined(HG_CMP_MSC)
|
||||
HGResult ret = HGBase_CreateDll("libmupdf.dll", &m_dll);
|
||||
strcat(dllPath, "libmupdf.dll");
|
||||
#else
|
||||
HGResult ret = HGBase_CreateDll("libmupdf.so", &m_dll);
|
||||
strcat(dllPath, "libmupdf.so");
|
||||
#endif
|
||||
HGBase_SetCurrentDir(oldDir);
|
||||
HGResult ret = HGBase_CreateDll(dllPath, &m_dll);
|
||||
if (HGBASE_ERR_OK != ret)
|
||||
{
|
||||
return ret;
|
||||
|
@ -561,20 +558,17 @@ HGResult HGPdfImageWriterImpl::Open(const HGChar* fileName)
|
|||
|
||||
assert(NULL == m_dll);
|
||||
|
||||
HGChar oldDir[256];
|
||||
HGBase_GetCurrentDir(oldDir, 256);
|
||||
HGChar moduleName[256];
|
||||
HGBase_GetModuleName(union_cast<void*>(&HGPdfImageWriterImpl::Open), moduleName, 256);
|
||||
HGChar newDir[256];
|
||||
HGBase_GetFilePath(moduleName, newDir, 256);
|
||||
HGChar dllPath[256];
|
||||
HGBase_GetFilePath(moduleName, dllPath, 256);
|
||||
|
||||
HGBase_SetCurrentDir(newDir);
|
||||
#if defined(HG_CMP_MSC)
|
||||
HGResult ret = HGBase_CreateDll("pdflib.dll", &m_dll);
|
||||
strcat(dllPath, "pdflib.dll");
|
||||
#else
|
||||
HGResult ret = HGBase_CreateDll("libpdf.so", &m_dll);
|
||||
strcat(dllPath, "pdflib.so");
|
||||
#endif
|
||||
HGBase_SetCurrentDir(oldDir);
|
||||
HGResult ret = HGBase_CreateDll(dllPath, &m_dll);
|
||||
if (HGBASE_ERR_OK != ret)
|
||||
{
|
||||
return ret;
|
||||
|
|
|
@ -38,20 +38,17 @@ HGResult HGOCRHanvon::Init()
|
|||
|
||||
assert(NULL == m_dll);
|
||||
|
||||
HGChar oldDir[256];
|
||||
HGBase_GetCurrentDir(oldDir, 256);
|
||||
HGChar moduleName[256];
|
||||
HGBase_GetModuleName(union_cast<void*>(&HGOCRHanvon::Init), moduleName, 256);
|
||||
HGChar newDir[256];
|
||||
HGBase_GetFilePath(moduleName, newDir, 256);
|
||||
HGChar dllPath[256];
|
||||
HGBase_GetFilePath(moduleName, dllPath, 256);
|
||||
|
||||
HGBase_SetCurrentDir(newDir);
|
||||
#if defined(HG_CMP_MSC)
|
||||
HGResult ret = HGBase_CreateDll("hanwangOCRdetect.dll", &m_dll);
|
||||
strcat(dllPath, "hanwangOCRdetect.dll");
|
||||
#else
|
||||
HGResult ret = HGBase_CreateDll("libhwocrdetect.so", &m_dll);
|
||||
strcat(dllPath, "libhwocrdetect.so");
|
||||
#endif
|
||||
HGBase_SetCurrentDir(oldDir);
|
||||
HGResult ret = HGBase_CreateDll(dllPath, &m_dll);
|
||||
if (HGBASE_ERR_OK != ret)
|
||||
{
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue