Linking with -shared and -pthread...

Peter Wood peter at alastria.net
Mon Sep 1 13:43:18 PDT 2003


Evenin,

Heh after talking to Josh I released it was a rather stupid mistake, of course
"pthread_conf_wait" doesn't exist :). So just as a heads up there wasn't
actually anything wrong.

Okey, I'm gonna go crawl under a rock,

Peter.
-- 
Peter Wood <peter at alastria.net> :: Tel +44 7974 799440

On Sun, 31 Aug 2003 12:19:27 -0700, you wrote:

>On Sun, Aug 31, 2003 at 08:13:03PM +0100 or thereabouts, Peter Wood wrote:
>> Good Evening,
>> 
>> I've been looking at writing a program that uses both shared libraries
>> (dlopen/dlclose) and POSIX threads. I however haven't had any success in my
>> simple tests.
>> 
>> After doing some research via google I found that due to -shared pthreads
>> wasn't linked into the shared library, fair enough, it's logical.
>> 
>> My question is, is it possible to write programs that use pthreads in their
>> shared libraries on FreeBSD.
>> 
>> For compiling the base program (that is the program that loads the shared
>> libraries) I've been using:
>> 
>> gcc -export-dynamic -pthread master.c -o master
>
>I use something like
>gcc -Wl,-export-dynamic master.c -o master -lc_r
>
>> 
>> And for each of the shared libaries I've been using:
>> 
>> gcc -shared -pthread slave.c -o slave.so
>
>I use
>gcc -shared -fPIC -DPIC slave.c -o slave.so
>
>The pthread functions from `master' will automatically be exported to `slave'.
>
>-- Josh
>_______________________________________________
>freebsd-hackers at freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
>To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
>



More information about the freebsd-hackers mailing list