Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Compiling libraries which might be used in threaded or unthreaded apps?

0
Posted

Compiling libraries which might be used in threaded or unthreaded apps?

0

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.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.