From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13730 invoked by alias); 4 Mar 2011 16:55:56 -0000 Received: (qmail 13676 invoked by uid 22791); 4 Mar 2011 16:55:55 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-iw0-f169.google.com (HELO mail-iw0-f169.google.com) (209.85.214.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Mar 2011 16:55:50 +0000 Received: by iwl42 with SMTP id 42so2803455iwl.0 for ; Fri, 04 Mar 2011 08:55:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.43.53.208 with SMTP id vr16mr904166icb.245.1299257748104; Fri, 04 Mar 2011 08:55:48 -0800 (PST) Received: by 10.42.60.129 with HTTP; Fri, 4 Mar 2011 08:55:48 -0800 (PST) In-Reply-To: References: Date: Fri, 04 Mar 2011 16:55:00 -0000 Message-ID: Subject: Re: Support for automatic linking via pragma From: "H.J. Lu" To: Ian Lance Taylor Cc: Olaf van der Spek , binutils@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00061.txt.bz2 On Fri, Mar 4, 2011 at 8:52 AM, Ian Lance Taylor wrote: > "H.J. Lu" writes: > >> On Fri, Mar 4, 2011 at 8:29 AM, Olaf van der Spek = wrote: >>> On Mon, Feb 28, 2011 at 7:17 PM, Olaf van der Spek wrote: >>>> Hi, >>>> >>>> I've submitted a feature request for automatic linking via pragma: >>>> http://sourceware.org/bugzilla/show_bug.cgi?id=3D12485 >>>> What do others think about the idea? >>> >>> Somebody? >>> >>> Let me quote the request: >>> MSVC supports the following pragma, which can be used to automatically = link a >>> library when a header file is included. This is used by for example Boo= st. >>> >>> It makes linking with the right lib a lot simpler. No more fiddling >>> with autoconf to detect the right lib name. >>> >> >> Not necessarily. =A0Unlike DSO, object files don't have ABI/API >> information. You may not link foo.o compiled with glibc 2.5/libbar >> 1.3 against glibc 2.13/libbar 1.9 > > I don't see how that is relevant to what Olaf is talking about. > > What Olaf is saying is that he wants to be able to have a .h file > automatically a -l option to the link command line. Don't you need to store such information in object files? > What you are saying is that if that you have a .o file, you have to link > against the -l which corresponds to the .h file which was used when the > .o file was compiled. =A0That is of course a real problem, but it's a > problem that exists whether or not we implement the MSVC pragma. > There is no such problem for DSO since we can encode ABI/API info in DSO. --=20 H.J.