public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Andrew Begel" <abegel@eecs.berkeley.edu>
To: <binutils@sources.redhat.com>
Cc: <abegel@cs.berkeley.edu>
Subject: dlltool not creating a proper import library
Date: Mon, 04 Jun 2001 16:01:00 -0000	[thread overview]
Message-ID: <B7D7A2ED64049746BBCDFB0DA028CC5404A54A@ups.millennium.berkeley.edu> (raw)

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

             reply	other threads:[~2001-06-04 16:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-04 16:01 Andrew Begel [this message]
2001-06-04 16:39 ` DJ Delorie
2001-06-04 23:31 ` AW: " Ralf Habacker
2001-06-04 16:48 Andrew Begel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B7D7A2ED64049746BBCDFB0DA028CC5404A54A@ups.millennium.berkeley.edu \
    --to=abegel@eecs.berkeley.edu \
    --cc=abegel@cs.berkeley.edu \
    --cc=binutils@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).