From owner-freebsd-hackers@FreeBSD.ORG Sun Aug 31 12:13:08 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DF12C16A4BF for ; Sun, 31 Aug 2003 12:13:07 -0700 (PDT) Received: from planet.alastria.net (planet.alastria.net [66.111.42.100]) by mx1.FreeBSD.org (Postfix) with ESMTP id EB39343FE1 for ; Sun, 31 Aug 2003 12:13:06 -0700 (PDT) (envelope-from peter@alastria.net) Received: from CAESIUM.hilbre.org.uk (m7-mp1.n05.man.dial.ntli.net [217.137.176.7] (may be forged)) by planet.alastria.net (8.12.8p1/8.12.8) with SMTP id h7VJD1cF049965 for ; Sun, 31 Aug 2003 20:13:02 +0100 (BST) (envelope-from peter@alastria.net) From: Peter Wood To: freebsd-hackers@freebsd.org Date: Sun, 31 Aug 2003 20:13:03 +0100 Organization: Alastria Networks Message-ID: X-Mailer: Forte Agent 1.91/32.564 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Linking with -shared and -pthread... X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Aug 2003 19:13:08 -0000 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 :: Tel +44 7974 799440