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

Back to archive index
Eli Zaretskii eliz****@gnu*****
Wed Jan 22 01:53:30 JST 2020


> From: Joachim Wuttke <j.wut****@fz-ju*****>
> Date: Tue, 21 Jan 2020 17:25:07 +0100
> 
> 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.

Isn't the __imp__ prefix supposed to be in the import library, not in
the shared library (a.k.a. "DLL")?  And if mylib.lib _is_ an import
library, then how did you build it, exactly, i.e. with what MinGW
commands?



More information about the MinGW-Users mailing list
Back to archive index