On 4/18/2012 21:53, MARTIN Pierre wrote: > Hello dear list readers, > > This topic is a whole new one, this is on purpose, and i'd like to solve this > in parallel with the other one (Delay-loading my libraries). > In this one, it is more about loading third-party DLLs directly in my > projects. The DLLs i would like to use from my project (And i'm not even > trying to delay-load them, for now) are from various scanner constructors > (Canon, Epson, Panini), and i have a set of 5 DLLs with only a .lib for some > of them: > - On the 6 i have, i ported the code to LoadLibrary / GetProcAddress etc on 3 > of them, so i only need to link against the remaining 3. > - 2 of those are likely to export the same functions... This was a huge > bummer, as i have no idea how to switch between one or another. So i changed > all the code from using direct function names to code using GetProcAddress > and friends. So now, the binary doesn't have to link against those 2 neither. > > For the remaining one (Which is the VisionAPI from Panini), i am kind of > stuck. I'm trying to link directly against the vendor DLL, but i get a lot of > linker errors (See the end of this eMail). > > So now, i believe i won't be able to link against the DLL directly as > suggested by another user of mingw list. > > What do you recommend in such scenario, keeping in mind that i will need to > delay load the library? i would say: convert all the code to use LoadLibrary > / GetProcAddress and friends, but specifically for this library it is quite a > huge amount of work... Which i would like to avoid if possible. > > g++ -mthreads -shared > -Wl,--out-implib,c:\Home\Administrator\Documents\PQRRS\PQRRS\Debug\libSCLibrary.a > -o ..\..\PQRRS\Debug\SCLibrary.dll object_script.SCLibrary.Debug > -L"c:\QtSdk\Desktop\Qt\4.8.1\mingw-w64\lib" > -LC:/Home/Administrator/Documents/PQRRS/PQRRS/Debug -lRELibrary > -LC:/Home/Administrator/Documents/PQRRS/PQRRS/SCLibrary/ThirdParty/win32/lib > -lVisionAPI -lQtGuid4 -lQtCored4 > Creating library file: > c:\Home\Administrator\Documents\PQRRS\PQRRS\Debug\libSCLibrary.a > mingw32-make.exe[2]: Leaving directory > `C:/Home/Administrator/Documents/PQRRS/Debug/SCLibrary' > mingw32-make.exe[1]: Leaving directory > `C:/Home/Administrator/Documents/PQRRS/Debug/SCLibrary' > ./debug\PaniniIDealController.o: In function `~PaniniIDealController': > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:46: > undefined reference to `_imp___Z8ShutDownm@4' > ./debug\PaniniIDealController.o: In function > `ZNK2SC21PaniniIDealController11deviceStateEv': > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:56: > undefined reference to `_imp___Z14GetDeviceStatemPm@8' > ./debug\PaniniIDealController.o: In function > `ZN2SC21PaniniIDealController12doInitializeEv': > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:115: > undefined reference to `_imp___Z19VApiSetDeviceEnginem@4' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:116: > undefined reference to `_imp___Z7StartUpP6HWND__j@8' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:125: > undefined reference to `_imp___Z16ChangeParametersm@4' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:133: > undefined reference to `_imp___Z6OnLinem@4' > ./debug\PaniniIDealController.o: In function > `ZN2SC21PaniniIDealController11doConfigureERKNS_6ConfigE': > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:145: > undefined reference to `_imp___Z16ChangeParametersm@4' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:147: > undefined reference to `_imp___Z14GetDeviceErrormPm@8' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:229: > undefined reference to `_imp___Z18SetImageAdjustmentmiii@16' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:232: > undefined reference to > `_imp___Z19SetDeviceParametersm17_DeviceParameters@524' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:234: > undefined reference to `_imp___Z14GetDeviceErrormPm@8' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:241: > undefined reference to `_imp___Z6OnLinem@4' > ./debug\PaniniIDealController.o: In function > `ZN2SC21PaniniIDealController17doStartProcessingEv': > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:261: > undefined reference to `_imp___Z6OnLinem@4' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:273: > undefined reference to `_imp___Z12StartFeedingm@4' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:275: > undefined reference to `_imp___Z14GetDeviceErrormPm@8' > ./debug\PaniniIDealController.o: In function > `ZN2SC21PaniniIDealController16doStopProcessingEv': > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:286: > undefined reference to `_imp___Z11StopFeedingm@4' > ./debug\PaniniIDealController.o: In function > `ZN2SC21PaniniIDealController13onDeviceEventEjl': > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:314: > undefined reference to `_imp___Z8ShutDownm@4' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:323: > undefined reference to `_imp___Z6OnLinem@4' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:333: > undefined reference to `_imp___Z11StopFeedingm@4' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:364: > undefined reference to `_imp___Z14GetOCRCodelinemPhPcmii@24' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:367: > undefined reference to `_imp___Z12VApiGetErrorv@0' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:369: > undefined reference to `_imp___Z16FreeImagesBufferP13_ImagesStruct@4' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:376: > undefined reference to `_imp___Z15GetMicrCodelinemPcm@12' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:386: > undefined reference to `_imp___Z17GetDocumentLengthmmPm@12' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:390: > undefined reference to `_imp___Z9SetPocketmmh@12' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:392: > undefined reference to `_imp___Z14GetDeviceErrormPm@8' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:404: > undefined reference to `_imp___Z14EnableFrankingmmm@12' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:406: > undefined reference to `_imp___Z14GetDeviceErrormPm@8' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:419: > undefined reference to `_imp___Z16FreeImagesBufferP13_ImagesStruct@4' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:442: > undefined reference to `_imp___Z14GetDeviceErrormPm@8' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:469: > undefined reference to `_imp___Z14GetSorterErrormPm@8' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:491: > undefined reference to `_imp___Z9FreeTrackmh@8' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:498: > undefined reference to `_imp___Z9FreeTrackmh@8' > C:\Home\Administrator\Documents\PQRRS\Debug\SCLibrary/../../PQRRS/SCLibrary/src/Controllers/PaniniIDealController.cpp:509: > undefined reference to `_imp___Z12StartFeedingm@4' > ETC ETC ETC ETC > collect2: ld returned 1 exit status > mingw32-make.exe[2]: *** [..\..\PQRRS\Debug\SCLibrary.dll] Error 1 > mingw32-make.exe[1]: *** [debug] Error 2 > mingw32-make.exe: *** [sub-SCLibrary-make_default-ordered] Error 2 > 15:22:50: The process "C:\MinGW\mingw-w64\bin\mingw32-make.exe" exited with > code 2. > Error while building project Recognition Suite (target: Desktop) > When executing build step 'Make'
Please check the DLL with gendef, see if the functions are mangled. Do you see ShutDown or something that begins with a '?'? If the former, you are likely missing extern "C" declarations when you included your vendor headers. If the latter, the vendor DLL is C++ and won't run link properly with GCC, though it looks like it could be solved with some extra thunk coding on the MSVC side.
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
