Trying to compile a slightly modified sample code .c file with the following cmds results in undefined
references to __imp__OCR_Init@12, etc.
Does anyone know the correct #defines and gcc switches to make this work?
Compiling with gcc instead of g++ throws a lot of errors for coding convention violations,
which is why I tried g++ even though it's just C code.
Thanks
g++ -c doOCR.c -I . \
-I ../tcl/generic -I PDFX/Examples/Include
g++ -o doOCR.exe doOCR.o --enable-stdcall-fixup -I . -I ../tcl/generic -I PDFX/Examples/Include \
-static-libstdc++ -static-libgcc \
xcpro40.dll ocrtools.dll ../tcl/win/tcl85.dll
MinGW, GCC compile/link issue
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Stefan - PDF-XChange
-
Stefan - PDF-XChange
- Site Admin
- Posts: 19942
- Joined: Mon Jan 12, 2009 8:07 am
Re: MinGW, GCC compile/link issue
Hello Clif,
Thanks for this post and the e-mail with the .h files you are trying to use. I will discuss this with one of my colleagues working on the OCR SDK - and he will post here or reply to your e-mail if more appropriate.
Best,
Stefan
Thanks for this post and the e-mail with the .h files you are trying to use. I will discuss this with one of my colleagues working on the OCR SDK - and he will post here or reply to your e-mail if more appropriate.
Best,
Stefan
-
Walter-Tracker Supp
- User
- Posts: 381
- Joined: Mon Jun 13, 2011 5:10 pm
Re: MinGW, GCC compile/link issue
It appears that the linker is looking for decorated names "__imp__OCR_xxxxx()" instead of the undecorated ones exported from the DLL ("OCR_xxxx()"). Check your linker settings to ensure it uses undecorated names.
I've not used mingw before though, so you'll have to figure out how to do this yourself.
This might also be relevant; not sure:
http://www.mingw.org/wiki/CreateImportLibraries
You might also make sure you are using the right calling conventions: the library uses Windows __stdcall (which is defined by the #define OCR_API WINAPI (and WINAPI in turn includes the __stdcall calling convention decorator):
http://msdn.microsoft.com/en-us/library ... 00%29.aspx
I've not used mingw before though, so you'll have to figure out how to do this yourself.
This might also be relevant; not sure:
http://www.mingw.org/wiki/CreateImportLibraries
You might also make sure you are using the right calling conventions: the library uses Windows __stdcall (which is defined by the #define OCR_API WINAPI (and WINAPI in turn includes the __stdcall calling convention decorator):
http://msdn.microsoft.com/en-us/library ... 00%29.aspx
-
cflynt
- User
- Posts: 5
- Joined: Fri Aug 31, 2012 1:52 am
Re: MinGW, GCC compile/link issue
Thanks for the replies. Just for the benefit of other mingw/gcc users (and perhaps to get a better answer
from another mingw/gcc user), what I ended up doing was to modify the ocrtools.h file by hardcoding
these #defines at the start of the file:
#define OCR_API WINAPI
#define OCRTOOLS_API
This allowed me to generate .o files that weren't looking for decorations.
from another mingw/gcc user), what I ended up doing was to modify the ocrtools.h file by hardcoding
these #defines at the start of the file:
#define OCR_API WINAPI
#define OCRTOOLS_API
This allowed me to generate .o files that weren't looking for decorations.
-
Walter-Tracker Supp
- User
- Posts: 381
- Joined: Mon Jun 13, 2011 5:10 pm
Re: MinGW, GCC compile/link issue
Thank you, Clif.
-Walter
-Walter