Unsolved Linking .lib file generated with MSVC in Qt Creator that uses gcc
-
Hi, I need to use a library generated with MSVC in my GCC project, what are the solutions and their pros and cons?
-
@AathakA
Unfortunately, that is not possible. -
Hi,
There are two cases:
- C++ library ? No way as @posktomten wrote
- C library ? Nothing special to do, use it and link to it
-
@SGaist Well, since a C library works one could write a wrapper around the MSVC C++ library (using an MSVC compiler) and then use the C bridge from within GCC. Also, the name mangling (Microsoft calls it 'decorated names') seems to be well documented, so you could call the mangled name by hand/write a bridge class that internally calls the mangled name. It is definitely messy and tedious to use a library compiled for a different compiler.
Did find just this: https://gcc-help.gcc.gnu.narkive.com/8ikYYHZN/convert-gcc-under-cygwin-name-mangling-to-vc-name-mangling
Besides the name mangling there is additional problems with the C++ ABI. This leaves only a C wrapper to interface between MSVC C++ and GCC C++.