Make MinGW dll to be used by MSVC application

Make MinGW dll to be used by MSVC application
Zhuotong Nan, [email protected]

1. We cannot directly use dynamic libararies generated by MinGW in MSVC application
2. To enable this, it’s easy. In eclipse, open project property window, go to the MinGW c++ settings page, and enable –output-def by giving a def name.
3. Compile, this time it will generate a def file along with the dll file.
4. In msvc command window, type "lib /machine:x86 /def:def_file.def". It will create a lib file and a exp file.
5. In msvc ide, import this lib file as the common dll generated by MSVC.
6. The above described for only C functions, or c++ functions with extern "C" keywords. all c++ functions and any functions inside c++ class cannot be called by MSVC in this means. For information to address this so-called ABI (Application Binary Interface) issues between c++ compilers, please google with "ABI C++". In a short word, there is no easy way to do the interoperation. But there might be some workarounds.

Reference:
1. http://www.mingw.org/MinGWiki/index.php/MSVC-MinGW-DLL

Leave a Reply

Your email address will not be published. Required fields are marked *