Compiling libraries which might be used in threaded or unthreaded apps?
What *is* the straight scoop on how to compile libraries which might be used in threaded or unthreaded apps? Hopefully the “errno” and “putc()” macros will continue to work even if libthread isn’t pulled in, so that vendors can make a single version of any particular library. A: Always compile *all* libraries with the reentrancy flag (_REENTRANT for UI threads, _POSIX_C_SOURCE=199506L for POSIX threads). Otherwise some poor soul will try to use your library and get hammered. putc() and getc() WILL be slower, but you may use putc_unlocked() & getc_unlocked() if you know the I/O stream will be used safely. All Solaris libraries are compiled like this.