public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* dlltool not creating a proper import library
@ 2001-06-04 16:01 Andrew Begel
  2001-06-04 16:39 ` DJ Delorie
  2001-06-04 23:31 ` AW: " Ralf Habacker
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Begel @ 2001-06-04 16:01 UTC (permalink / raw)
  To: binutils; +Cc: abegel

I'm try to use the Mingw32 dlltool to produce an import library from a
.def file I've got. But, the generated import library seems to be
missing a symbol that ld wants to see when it links the import library
with my code. 

When gcc -shared creates a DLL and associated import library (using the
-Wl,--outimp=libfoo.dll.a flag), for each exported symbol, in the
libfoo.dll.a file there are three symbols. One is the original symbol
_bar, the second is
__imp__bar, and the third is __nm__bar.=20

However, when I use dlltool to make an import library from a .def file,
I only get two  symbols for each exported symbol: _bar and __imp_bar.
When I try to link a DLL from a static library that contains my
generated import library (from the .def file), ld complains that
I'm missing the __nm__bar symbol:

i.e. nmth000000.o(.idata$4+0x0): undefined reference to `_nm__bar'

Before this error, I get a warning about the symbol:

Warning: resolving _bar by linking to __imp__bar (auto-import)

In my .def, I have

bar DATA

listed on its own line,

bar is decorated with

extern __declspec(dllimport) int bar;

in its .h file, and my C++ code that includes this .h, references bar.

Is this something where dlltool didn't get changed in sync with gcc
-shared, or is there a flag I can pass to make this work?

Thanks,

Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dlltool not creating a proper import library
  2001-06-04 16:01 dlltool not creating a proper import library Andrew Begel
@ 2001-06-04 16:39 ` DJ Delorie
  2001-06-04 23:31 ` AW: " Ralf Habacker
  1 sibling, 0 replies; 3+ messages in thread
From: DJ Delorie @ 2001-06-04 16:39 UTC (permalink / raw)
  To: abegel; +Cc: binutils, abegel

It sounds to me like you're not using the official versions
of the sources, because:

1. gcc doesn't have "nm_" anywhere in it's backend sources.
2. Nothing in the linker does either.
3. I can't find the string "auto-import" in the sources anywhere.

So, unless you can reproduce this with the official tools, nobody here
is going to be able to help you much.  Have you tried reporting this
to the mingw list?

> However, when I use dlltool to make an import library from a .def file,
> I only get two  symbols for each exported symbol: _bar and __imp_bar.

This is normal.  For data symbols, you only get the _imp_ one.  And,
you'd get _imp__bar, not __imp_bar (the latter is obsolete).

^ permalink raw reply	[flat|nested] 3+ messages in thread

* AW: dlltool not creating a proper import library
  2001-06-04 16:01 dlltool not creating a proper import library Andrew Begel
  2001-06-04 16:39 ` DJ Delorie
@ 2001-06-04 23:31 ` Ralf Habacker
  1 sibling, 0 replies; 3+ messages in thread
From: Ralf Habacker @ 2001-06-04 23:31 UTC (permalink / raw)
  To: Binutils; +Cc: Andrew Begel

> Von: binutils-owner@sources.redhat.com
> [ mailto:binutils-owner@sources.redhat.com]Im Auftrag von Andrew Begel
> Gesendet am: Dienstag, 5. Juni 2001 01:02
> An: binutils@sources.redhat.com
> Cc: abegel@cs.berkeley.edu
> Betreff: dlltool not creating a proper import library
>
> I'm try to use the Mingw32 dlltool to produce an import library from a
> .def file I've got. But, the generated import library seems to be
> missing a symbol that ld wants to see when it links the import library
> with my code.
>
> When gcc -shared creates a DLL and associated import library (using the
> -Wl,--outimp=libfoo.dll.a flag), for each exported symbol, in the
> libfoo.dll.a file there are three symbols. One is the original symbol
> _bar, the second is
> __imp__bar, and the third is __nm__bar.=20
>
> However, when I use dlltool to make an import library from a .def file,
> I only get two  symbols for each exported symbol: _bar and __imp_bar.
> When I try to link a DLL from a static library that contains my
> generated import library (from the .def file), ld complains that
> I'm missing the __nm__bar symbol:
>
> i.e. nmth000000.o(.idata$4+0x0): undefined reference to `_nm__bar'
>
> Before this error, I get a warning about the symbol:
>
> Warning: resolving _bar by linking to __imp__bar (auto-import)
>
It seems that you are using an ld with the auto import option provided by
Paul Sokolvsky.
This ld contains an additional patch for skipping
__declspec(dllimport/dllexport)
Look at the sourceforge mingw project for additional information.

Ralf Habacker

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-06-04 23:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-04 16:01 dlltool not creating a proper import library Andrew Begel
2001-06-04 16:39 ` DJ Delorie
2001-06-04 23:31 ` AW: " Ralf Habacker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).