[Top][All Lists]

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

MinGW link against an MS Windows import library

From: Bill Jones
Subject: MinGW link against an MS Windows import library
Date: Tue, 13 Apr 2004 15:47:40 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1

I could not find any recent discussion of this topic in the list archives.

I am trying to use libtool to create a DLL which requires linking my objects against a non-libtool MS Windows import library provided by a 3rd party vendor. The import library has the ".lib" extension and is in a separate directory from the DLL (with ".dll" extension). I am using MinGW 3.1.0, Msys 1.0.9, Msys-DTK 1.0.1 (upgraded to automake-1.8.2, autoconf-2.59, and libtool-1.5.2).

Assuming that $import_lib_path is the location of the *.lib file and $import_root_name is the root name of the library (i.e. "foo" for "libfoo.lib"), I have tried adding the following to la_LIBADD in

1) "-L$import_lib_path -l$import_root_name" results in "ld.exe cannot find -lfoo"

2) "$import_lib_path/lib$import_root_name.lib" is treated as an argument not a library, ignored by libtool as it is not passed to the generated gcc command. However, issuing the gcc command manually works. I think this is because the $lib_ext is set to "a" in the libtool script so this is processed as an argument.

3) Against my better judgement, I tried to alter $libext in my libtool script setting it to "lib". This, however, again dropped the import library argument as libtool viewed the file as a static lib and issued

*** Warning: Trying to link with static lib archive $import_lib_path/lib$import_root_name.lib.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because the file extensions .lib of this argument makes me believe
*** that it is just a static archive that I should not used here.

4) Specify path to DLL as $import_lib_path will link but generates an unusable libfoo.dll (no supprise here?).

I have also tried to use the depreicated AC_LIBTOOL_WIN32_DLL in my with no differences.

So the basic question is how do I specify a static import library with a *.lib extension to be used by libtool for resolving the symbols provided by a non-libtool DLL when building a dependent DLL with libtool?

Any help would be appreciated even if I am doing something totally stupid,


    Bill Jones                                   address@hidden
    Mail Stop 125                       Data Analysis and Imaging Branch
    15 Langley Boulevard                  Systems Engineering Competency
    NASA Langley Research Center                Building 1268, Room 1038
    Hampton, VA  23681-2199                        Phone +1 757 864-5318
                                                     Fax +1 757 864-7635

reply via email to

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