Using msvc lib in mingw

I have hardware (xray sensor) which has development tools. but afaiu they are built in msvc. so i have a .lib file and a dll file. if I include this lib file in my project (I use qt) and put the dll file in the exe folder and compile it using the MSVC-Release everytihng option. But when I try to compile using the mingw-Release option. he fails.

undefined link to `imp__ZN6IDcDrv6CreateEPKci '

undefined reference to `imp__ZN6IDcDrv14GetDeviceCountEv '

can you specify some way out so i can use these libs. and dll using the mingw compiler

ps: i tried and failed impdef dclibsn.dll> dclib.def

dlltool -dllname dclibsn.dll --def dclib.def --output-lib libdclibsn.a

and so my def file looks like

LIBRARY "dclibsn.dll"
EXPORTS
??0DcDrv@@QAE@ABV0@@Z
??0DcDrv@@QAE@V?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z
??0IDcDrv@@QAE@ABV0@@Z
??0IDcDrv@@QAE@XZ
??1DcDrv@@QAE@XZ
??4DcDrv@@QAEAAV0@ABV0@@Z
??4IDcDrv@@QAEAAV0@ABV0@@Z
?CaptureImage@DcDrv@@AAE_NHHHK_NHH@Z
?CloseUsbDevice@DcDrv@@AAE_NXZ
?ColumnDefectComp@DcDrv@@AAEGPBGH@Z
?CompensationImage@DcDrv@@AAEXPAGQAEHH@Z
?Create@IDcDrv@@SAPAVDcDrv@@PBDH@Z

Pay attention to the last entry in this file (Create.) I try to call this in a program, and I get

(.text+0x1ad): undefined reference to `_imp___ZN6IDcDrv6CreateEPKci'

and if I replace the string? Create @IDcDrv @@ SAPAVDcDrv @@ PBDH @Z

with imp__ZN6IDcDrv6CreateEPKci compiles, but gives an error.

The procedure entry point _ZN6IDcDrv6CreateEPKci could not be located in the dynamic link library dclibsn.DLL. 
+5
source share
4 answers

See this: How to use libraries compiled with MingW in MSVC?

I mean the #include environment with an external "C" block. Because using extern "C" will instruct the compiler that the functions use the C link, not C ++, which will stop it from doing manipulation of function names.

, mangling . , dll . , . , dll CUDA MSVC 2005 mingw.

.: -?

+1

, , , , , mingw, - dll libs msvc, .

0

: , .. ++ , , MS GCC. , , MingW (_ZN6IDcDrv6CreateEPKci) , ?Create@IDcDrv@@SAPAVDcDrv@@PBDH@Z).

, ++, . , ++ - , MS - GNU, , , .

, C- ( POD), extern "C" . , lib, , . (, MSVC , ), extern "C". , MSVC, extern "C".

0

@thithon, C. , "", .

Entry point error because you probably don't have the main () in your dll. Just add one (even if its empty, it doesn't matter) and this error will disappear.

0
source

All Articles