From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25056 invoked by alias); 4 Mar 2011 18:40:33 -0000 Received: (qmail 25042 invoked by uid 22791); 4 Mar 2011 18:40:32 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Mar 2011 18:40:27 +0000 Received: from wpaz33.hot.corp.google.com (wpaz33.hot.corp.google.com [172.24.198.97]) by smtp-out.google.com with ESMTP id p24IeOJV013401 for ; Fri, 4 Mar 2011 10:40:25 -0800 Received: from pxi1 (pxi1.prod.google.com [10.243.27.1]) by wpaz33.hot.corp.google.com with ESMTP id p24IeMsF012427 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Fri, 4 Mar 2011 10:40:23 -0800 Received: by pxi1 with SMTP id 1so519089pxi.37 for ; Fri, 04 Mar 2011 10:40:22 -0800 (PST) Received: by 10.142.203.17 with SMTP id a17mr655788wfg.207.1299264022054; Fri, 04 Mar 2011 10:40:22 -0800 (PST) Received: from coign.google.com (dhcp-172-22-123-197.mtv.corp.google.com [172.22.123.197]) by mx.google.com with ESMTPS id 25sm3305460wfb.10.2011.03.04.10.40.20 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Mar 2011 10:40:21 -0800 (PST) From: Ian Lance Taylor To: "H.J. Lu" Cc: Olaf van der Spek , binutils@sourceware.org Subject: Re: Support for automatic linking via pragma References: Date: Fri, 04 Mar 2011 18:40:00 -0000 In-Reply-To: (H. J. Lu's message of "Fri, 4 Mar 2011 08:55:48 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true 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/msg00068.txt.bz2 "H.J. Lu" writes: > 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: >>>> 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 Bo= ost. >>>> >>>> It makes linking with the right lib a lot simpler. No more fiddling >>>> with autoconf to detect the right lib name. >>>> >>> >>> Not necessarily. =C2=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? Yes, but so what? The meaning of the information in the object file is "when linking, add this -l option". That is not different from what exists today, except that today you have to remember to add the -l option yourself. Today, if you have an old object file, and you add the -l option yourself on the link line, you will have trouble. This proposal does not change that. It addresses a different issue. In the hopes of being more clear, the issue that this proposal addresses is that if your code does a #include , you have to also add -lglib on your command line. If this proposal were implemented, the second step would be unnecessary. This makes writing Makefiles simpler. >> 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. =C2=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. Yes, of course, but irrelevant to the issue at hand. Ian