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

Sergio NNX sfhac****@hotma*****
Wed Jan 22 05:01:46 JST 2020

Can we have a code snippet or test case we can build and test locally?

From: MinGW-Users <mingw****@lists*****> on behalf of Eli Zaretskii <eliz****@gnu*****>
Sent: Wednesday, 22 January 2020 5:02 AM
To: MinGW Users List <mingw****@lists*****>
Subject: Re: [Mingw-users] How to generate the _imp_ prefix?

[Please keep the discussion on the list.]

> From: Joachim Wuttke <j.wut****@fz-ju*****>
> Date: Tue, 21 Jan 2020 18:09:37 +0100
> > 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?
> Yes, mylib.lib is supposed to be an import library. This is where
> VS searches for symbols at link time. Until linking succeeds,
> I am not concerned about the DLL.
> The mylib project has tests that are linked with mylib.lib, and
> executed using mylib.dll. Works under MinGW. So the problem is
> with cross-compilation.
> Compilation is under control of gitlab-runner and CMake. The
> decisive line in .gitlab-ci.yml is
>      - cmake -G "Ninja" -DLIB_MAN=OFF -DCMAKE_INSTALL_PREFIX=C:\opt\x64 -B. -DCMAKE_GNUtoMS=ON ..

Ouch, Cmake!  Who knows what it does under the hood?  Did you
configure it correctly for MinGW, at least?  Perhaps ask it to display
all the commands verbosely and see what it actually does?

Anyway, the way I usually produce import libraries is via the
"-Wl,--out-implib=" switch to GCC on the link command line.  That
produces import libraries with the __imp__ prefixes, so this stuff
does work and the produced libraries should be usable with MSVC
(although I never tried).

MinGW-Users mailing list

This list observes the Etiquette found at
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

You may change your MinGW Account Options or unsubscribe at:
Also: mailto:mingw****@lists*****?subject=unsubscribe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/mingw-users/attachments/20200121/7e235ab9/attachment-0001.html>

More information about the MinGW-Users mailing list