On Apr 16, 2008, at 12:31 PM, Török Edwin wrote:
> Manpages indicate to use -pthread to link.
> Linux: man pthreads
> Compiling on Linux
>       On Linux, programs that use the Pthreads API should be compiled
> using cc -pthread
>
> FreeBSD:
> http://www.freebsd.org/cgi/man.cgi?query=pthread&apropos=0&sektion=0&manpath=FreeBSD+4.11-RELEASE&format=html
>
> A FreeBSD specific option has been added to gcc to make linking  
> threaded
> processes simple.  gcc -pthread links a threaded process against  
> libc_r
> INSTEAD OF libc.

Historically, enabling POSIX threads required more than just linking  
to a libpthread.a/.so library.

It could need a preprocessor macro defined to change the includes from  
the system headers, for example, and the linking stage might need to  
pull in a different [g]crt0.o/[g]crt1.o prologue, or a different (re- 
entrant) std C library as mentioned above, etc.  So, the notion of "cc  
-pthread" was developed to roll all of the various changes that the  
compiler toolchain would need into a single flag...

Regards,
-- 
-Chuck

_______________________________________________
Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net
http://lurker.clamav.net/list/clamav-users.html

Reply via email to