This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
dlltool not creating a proper import library
- To: <binutils at sources dot redhat dot com>
- Subject: dlltool not creating a proper import library
- From: "Andrew Begel" <abegel at eecs dot berkeley dot edu>
- Date: Mon, 4 Jun 2001 16:01:34 -0700
- Cc: <abegel at cs dot berkeley dot edu>
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