This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]