Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Aug 2003 20:13:03 +0100
From:      Peter Wood <peter@alastria.net>
To:        freebsd-hackers@freebsd.org
Subject:   Linking with -shared and -pthread...
Message-ID:  <kkh4lv8pkgfn2so4ou9i9t3cvc0cimpcig@4ax.com>

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

=46or 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

And for each of the shared libaries I've been using:

gcc -shared -pthread slave.c -o slave.so

I had intended to use some form of message queue using a pthread =
condition.=20

The sample C files I've been using can be located at:
http://planet.alastria.net/~peter/hackers/master.c
http://planet.alastria.net/~peter/hackers/slave.c

Any light would be greatly apreciated,

Cheers,

Peter.
--=20
Peter Wood <peter@alastria.net> :: Tel +44 7974 799440



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