This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[pe-i386] Changes of 2001-12-17 break dll import libs built using ld -shared
- From: Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz>
- To: binutils <binutils at sources dot redhat dot com>
- Date: Thu, 24 Jan 2002 11:13:28 +1100 (EST)
- Subject: [pe-i386] Changes of 2001-12-17 break dll import libs built using ld -shared
Dll import libs built with binutils-20011217 and later are broken. Attempts
to link against them leads to undefined references for all exported
symbols. Objdump shows that the symbols are in the lib. The problem is
still evident as of 20020123 CVS. I am using NT4, with mingw (GCC-2.95.3)
compiler.
Import libs built using dllwrap or equivalent scripts, however, link
succesfully. Also, 20011217 (and later) is able to link successfully with
import libs that were built using ld -shared with 20011216 and earlier
Example:
With this testcase:
===============================================
/* test. c */
int __attribute__((dllexport)) dll_int (int i)
{
return i;
}
=================================================
/* usetest.c */
int __attribute__((dllimport)) dll_int (int i);
int main()
{
return dll_int(0);
}
=================================================
2001-12-16 works:
gcc -shared -v -o test20011216.dll -Bd:/binutils-20011216/bin/ \
-Wl,--out-implib,lib20011216.a test.c
gcc -o use20011216.exe -Bd:/binutils-20011216/bin/ usetest.c -L. -l20011216
2001-12-17 fails with undefined reference to _imp__dll_int:
gcc -shared -v -o test20011217.dll -Bd:/binutils-20011217/bin/ \
-Wl,--out-implib,lib20011217.a test.c
gcc -o use20011217.exe -Bd:/binutils-20011216/bin/ usetest.c -L. -l20011217
This works (using 20011216 built implib with 20011217 binutils):
gcc -o use20011217x.exe -Bd:/binutils-20011217/bin/ usetest.c -L.
-l20011216
There is no problem with dllwrap.
Danny
http://my.yahoo.com.au - My Yahoo!
- It's My Yahoo! Get your own!