[Mingw-users] How to generate the _imp_ prefix?

Joachim Wuttke j.wut****@fz-ju*****
Wed Jan 22 01:25:07 JST 2020

MinGW shall compile a shared C library mylib that contains functions like

   declspec(dllexport) int foo();

The library shall be used in a C++ application under Visual Studio.

To inspect the compilation outcome,

   dumpbin /HEADERS mylib.lib

prints one stance per exported function. The stance for the above function
foo contains the line

   Symbol name  : _foo

So, MinGW does not generate the prefix _imp_. Expectedly, linking the
dependent application fails because Visual Studio cannot find _imp_foo.

How to get this right?

[cross-posting from https://stackoverflow.com/questions/59845249/]

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5338 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.osdn.me/mailman/archives/mingw-users/attachments/20200121/0d4c977c/attachment.bin>

More information about the MinGW-Users mailing list