[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/5305] New: ld does not alias with .lib files

From: MichieldeB at aim dot com
Subject: [Bug ld/5305] New: ld does not alias with .lib files
Date: 9 Nov 2007 21:20:18 -0000

ld does not alias with .lib files. Of course, you can use .a files instead, if
you are able to generate them. Below is a makefile that generates an error. The
makefile requires components of VC Express to generate a .lib, namely lib.exe,
link.exe and mspdb80.dll.

The makefile generates two variants of a small application: one by using a .lib
file and one by using a .a file. The first variant does not work, because it
does not alias. But the "real-life application" by which I signaled the problem
does only not work when a .dll is generated with the .lib file (say,
foo_test_lib.dll). I have not been able yet to isolate the reason for that.

all:    foo_test_a.exe foo_test_lib.exe

        del foo*.* 

        echo extern "C" __declspec(dllexport) int foo() > 1.tmp
        echo { return 3840; } > 2.tmp
        copy /b 1.tmp+2.tmp foo.cpp
        del ?.tmp

        echo LIBRARY foo > 1.tmp
        echo EXPORTS > 2.tmp
        echo foo > 3.tmp
        echo bar = foo > 4.tmp
        copy /b 1.tmp+2.tmp+3.tmp+4.tmp foo.def
        del ?.tmp

foo.dll: foo.cpp
        g++ -shared foo.cpp -o foo.dll

foo.lib: foo.def
        lib /def:foo.def
        del foo.exp

foo.a: foo.def
        dlltool -d foo.def -l foo.a

        echo #include "stdio.h" > 1.tmp
        echo extern "C" __declspec(dllimport) int bar(); > 2.tmp
        echo main() { printf("%%x\n", bar()); } > 3.tmp
        copy /b 1.tmp+2.tmp+3.tmp foo_test.cpp
        del ?.tmp

foo_test.o: foo_test.cpp
        g++ -c foo_test.cpp -o foo_test.o

foo_test_a.exe: foo_test.o foo.a foo.dll
        g++ foo_test.o -o foo_test_a.exe -Wl,foo.a

foo_test_lib.exe: foo_test.cpp foo.lib foo.dll
        g++ foo_test.o -o foo_test_lib.exe -Wl,foo.lib

           Summary: ld does not alias with .lib files
           Product: binutils
           Version: 2.15
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: MichieldeB at aim dot com
                CC: bug-binutils at gnu dot org,nickc at redhat dot com


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]