Unhandled exception inside ocrtools-x64.dll
Posted: Fri Jul 22, 2016 1:22 pm
I'm using Visual Studio Community 2015 to build a 64-bit app that will OCR some PDF's through a scanning pipeline. I'm getting an unhandled exception during the OCR_LoadW call, and I can't seem to get by it. Short version of the code is:
The exception is:
Code: Select all
int main(int argc, char** argv) {
if (argc < 3) {
cout << "Both an input and output file must be specified on the command line" << endl;
return 0;
}
DWORD maxLevel;
PXODocument doc; ZeroMemory(&doc, sizeof(PXODocument));
HRESULT r;
r = OCR_Init(&doc, oldLicense, oldLicenseDev);
if (IS_DS_FAILED(r)) {
cout << "Failed to initialize OCR engine" << endl;
return -1;
}
r = OCR_SetCallback(&doc, &ocrCallback, (LPARAM)&maxLevel);
if (IS_DS_FAILED(r)) {
cout << "Failed to define callback procedure" << endl;
return -1;
}
string src(argv[1]);
wstring wsrc(src.begin(), src.end());
r = OCR_LoadW(doc, (LPWSTR)(wsrc.c_str())); // <- Exception occurs here
if (IS_DS_FAILED(r)) {
cout << "Unable to load " << argv[1] << endl;
return -1;
}
Code: Select all
Exception thrown at 0x000007FED16B104F (ocrtools-x64.dll) in pxpocr.exe: 0xC0000005: Access violation reading location 0x00000F00E90000FE.
Unhandled exception at 0x000007FED16B104F (ocrtools-x64.dll) in pxpocr.exe: 0xC0000005: Access violation reading location 0x00000F00E90000FE.