From owner-freebsd-hackers  Fri Feb 27 03:25:59 1998
Return-Path: <owner-freebsd-hackers@FreeBSD.ORG>
Received: (from majordom@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id DAA06087
          for freebsd-hackers-outgoing; Fri, 27 Feb 1998 03:25:59 -0800 (PST)
          (envelope-from owner-freebsd-hackers@FreeBSD.ORG)
Received: from postman.opengroup.org (postman.opengroup.org [130.105.1.152])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id DAA06082
          for <hackers@freebsd.org>; Fri, 27 Feb 1998 03:25:57 -0800 (PST)
          (envelope-from k.#nojunk#keithley@opengroup.org)
Received: from kaleb.keithley.belmont.ma.us (horizon1.camb.opengroup.org [130.105.39.25])
	by postman.opengroup.org (8.8.6/8.8.6) with SMTP id GAA11033
	for <hackers@freebsd.org>; Fri, 27 Feb 1998 06:25:25 -0500 (EST)
Message-ID: <34F6E95F.41C67EA6@opengroup.org>
Date: Fri, 27 Feb 1998 11:27:11 -0500
From: "Kaleb S. KEITHLEY" <k.#nojunk#keithley@opengroup.org>
Reply-To: kaleb@opengroup.org
Organization: The Open Group
X-Mailer: Mozilla 3.04Gold (X11; I; FreeBSD 3.0-971225-SNAP i386)
MIME-Version: 1.0
To: hackers@FreeBSD.ORG
Subject: symbols in libc_r not in libc
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
X-Loop: FreeBSD.ORG

Consider building an MT-safe library that might get used by both
threaded and non-threaded programs -- in this case libX11.

On a 3.0-971225-SNAP system, when I build Xlib thread-safe I use
-D_REENTRANT and -D_THREAD_SAFE, and all references to errno are
converted to *__error(). No problem there.

Now when I link a non-threaded program, e.g. xterm, to the mt-safe Xlib,
when I try to run it I get unresolved externals for ___error. 

What that tells me is that libc (not libc_r) needs a #pragma weak
__error so that when I link non-threaded programs against libX11,
they'll work, and when I link a threaded program with libX11 and libc_r,
it'll get the right version of __error.

And no, I don't want to require that all non-threaded programs link with
libc_r, nor do I want to link libX11 with libc_r and thereby cause all
programs that link with it to be implicitly linked with libc_r. I only
want the extra overhead (if there is any) when a program is explicitly
linked with libc_r.

(Hmmh. I subscribed to hackers a ways back, but it doesn't seem to have
taken. C'est la vie.)

--
Kaleb S. KEITHLEY

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message