Web lists-archives.com

Re: [Mingw-users] undefined reference to _imp__*

Okay.  Yes, I'm seeing the imp prefixes in the lib file.
However, the underscores are wrong.

If I build the import library with DLLTOOL using the --no-leading-underscore option, and then use "nm -A" to examine the file, I see names like ...

          __imp_SYMBOL1            (i.e. 2 underscores before imp and 1 before the name)

If I build it without that option, the names look like this ...

          __imp__SYMBOL1            (i.e. 2 underscores before imp and 2 before the name)

However, the linker is looking for names like ...

          _imp__SYMBOL1            (i.e. 1 underscore before imp and two before the name)

In other words, DLLTOOL seems to always prefix imp with two underscores, but the linker is looking for names where imp is prefixed by only a single underscore.

I tried linking again, but am still seeing the "undefined reference" messages, due to the extra underscore.

Any insights on how to handle this?

-----Original Message-----
From: Eli Zaretskii [mailto:eliz@xxxxxxx] 
Sent: Tuesday, January 17, 2017 1:40 PM
To: Cervinka, Mitch <mitch.cervinka@xxxxxxx>
Cc: mingw-users@xxxxxxxxxxxxxxxxxxxxx
Subject: Re: [Mingw-users] undefined reference to _imp__*

> From: "Cervinka, Mitch" <mitch.cervinka@xxxxxxx>
> Date: Tue, 17 Jan 2017 15:39:04 +0000
> Are you saying, then, that the DEF file from which the import library is created should provide an alias for each symbol in the DLL?

No, I don't think so.

If you run "nm -A" on the import library, which symbols do you see there?  You should see __imp__* symbols marked as "I" and the symbols from your DEF file marked as "T".  You can see an example of that if you run "nm -A" on one of the lib*.a import libraries that come with MinGW's w32api package.

Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
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-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe