[SOLVED]Ways to include MFC library in MinGw
-
wrote on 27 Jun 2013, 13:38 last edited by
Hi all,
From a supplier I got a driver and libraries to include into my project to handle CAN to USB communications. The dll comes with a header file and a lib file. The library is compiled with some kind of VC (visual C?) compiler, but an example program was also given using Visual Studio 2008. I'm just guessing, but that is probably also the compiler used for the dll creation.
For my own project I use the MinGw4.7 compiler delivered with the Qt5.0.1 SDK and I don't want to switch it to the Visual Studio because Microsoft is getting more and more cumbersome about licenses etc.
The real big question now is how to get that MSVC2008 lib into my MinGw project.
the things I tries:- static linking (just include the header file and add the library to the project with the library add-wizard), but the program crashed before it begins (code: 0xc0000318).
- Dynamic linking with QLibrary, but that just returns false when trying to open the library and resolve naturally returns 0 for the requested function.
My biggest question is if it is indeed possible to use the MSVC2008 library in a MinGw project with dynamic linking? If so, HOW?? Working on it all afternoon with no luck.
Any help would be very much appreciated.
Greetz -
i think thats not possible... since the library is compiled with MSVC.
I believe that mingw wont understand the exported symbols by the MSVC compiler.
But i would like to be proven wrong ;)Edit: found "this useful link":http://www.mingw.org/wiki/Interoperability_of_Libraries_Created_by_Different_Compiler_Brands.
Edit2: see also "this topic":http://stackoverflow.com/questions/2472924/linking-to-msvc-dll-from-mingw -
wrote on 28 Jun 2013, 01:36 last edited by
-
Which API don't these driver and libraries provided. C or C++ ?
As far as i know, most of low level APIs are provided through C API. -
If C++ API is provided, you can try to make a C wrapper using VC. Then the wrapper can be used directly by your MinGW.
-
-
indeed... what i forgot to mention in my previous post was:
The incompatibility only exists for exported C++ symbols/methods, but not for exported C methods (Hint: extern "C" {...}) -
wrote on 28 Jun 2013, 07:54 last edited by
Hee,
Thanks for the advice and the manufacturer gave me an usable C API instead of the C++ API build with MSVC2012. That solved the problem for me and you guys help me understand the problem.
It all has to do with name mangling between compilers (even different MSVC compiler are not able to be used together) Shouldn't they standardize this, would make our work a bit easier ;-)
Thanks!
2/5