delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/01/09/22:51:07

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <47859550.1070705@cwilson.fastmail.fm>
Date: Wed, 09 Jan 2008 22:47:28 -0500
From: Charles Wilson <cygwin AT cwilson DOT fastmail DOT fm>
User-Agent: Thunderbird 2.0.0.9 (Windows/20071031)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: cygwin, g++ and boost? Do I need dll.a?
References: <14705301 DOT post AT talk DOT nabble DOT com> <00db01c852bd$30386d00$2e08a8c0 AT CAM DOT ARTIMI DOT COM>
In-Reply-To: <00db01c852bd$30386d00$2e08a8c0@CAM.ARTIMI.COM>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Note-from-DJ: This may be spam

Dave Korn wrote:
>   Wrong reasoning.  The actual problem is that you need to remove the 'lib'
> prefix when supplying a library name:
> 
>> g++ -o hello -L/lib hello.cpp -lcrypt
>> g++ -o hello -L/lib hello.cpp -lbfd
> 
>   Ordinary .a files are for static linking, .dll.a files are for runtime
> linking against dlls, gcc selects the right one for you by using one of the
> -shared or -static flags.

Err, no.  gcc (by default) will use .dll.a files in preference to .a 
files -- more completely, the search pattern for -lxxx is, in each 
directory:

           libxxx.dll.a
           xxx.dll.a
           libxxx.a
           xxx.lib
           cygxxx.dll
           libxxx.dll
           xxx.dll
           libxxx.a (again, for architectural reasons)
           xxx      (this is so that stuff like -lmyspecific.o will
                     work as expected).

      before moving on to the next directory in the search path.

With -static, -lxxx only looks for:

           libxxx.a
           xxx

Note that, oddly, in -static mode a MS-style library name "xxx.lib" will 
be ignored, while in (normal) mode it will be used if found (and the 
other patterns ahead of it are not found).  Just an odd little quirk.

-shared is something competely different.  It means: make the output 
file a DLL instead of an executable.

--
Chuck

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019