Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Feb 1998 11:27:11 -0500
From:      "Kaleb S. KEITHLEY" <k.#nojunk#keithley@opengroup.org>
To:        hackers@FreeBSD.ORG
Subject:   symbols in libc_r not in libc
Message-ID:  <34F6E95F.41C67EA6@opengroup.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?34F6E95F.41C67EA6>