From owner-freebsd-threads@FreeBSD.ORG Thu Oct 6 08:55:56 2005 Return-Path: X-Original-To: threads@freebsd.org Delivered-To: freebsd-threads@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 202F516A41F for ; Thu, 6 Oct 2005 08:55:56 +0000 (GMT) (envelope-from jasone@canonware.com) Received: from mx3.uidaho.edu (mx3.uidaho.edu [129.101.155.247]) by mx1.FreeBSD.org (Postfix) with ESMTP id DE35F43D49 for ; Thu, 6 Oct 2005 08:55:54 +0000 (GMT) (envelope-from jasone@canonware.com) Received: from mailA.its.uidaho.edu (mailA.its.uidaho.edu [129.101.155.252]) by mx3.uidaho.edu (8.13.3/8.13.3) with ESMTP id j968tsBL026136 for ; Thu, 6 Oct 2005 01:55:54 -0700 Received: from [192.168.168.203] (moscow-cuda-gen2-68-64-60-20.losaca.adelphia.net [68.64.60.20]) by mailA.its.uidaho.edu (Go Vandals!) with ESMTPA id <0INX001SXKT4P6@mailA.its.uidaho.edu> for threads@freebsd.org; Thu, 06 Oct 2005 01:55:54 -0700 (PDT) Date: Thu, 06 Oct 2005 01:55:30 -0700 From: Jason Evans In-reply-to: <200510050202.36730@aldan> To: Mikhail Teterin Message-id: MIME-version: 1.0 (Apple Message framework v734) X-Mailer: Apple Mail (2.734) Content-type: text/plain; format=flowed; delsp=yes; charset=US-ASCII Content-transfer-encoding: 7bit References: <200510050202.36730@aldan> X-SpamDetails: rule=notspam policy=default score=0 mlx=0 adultscore=0 adjust=0 reason=mlx engine=3.0.0-05091301 definitions=3.0.0-05100503 X-SpamScore: 0 Cc: threads@freebsd.org, jim@corebsd.or.id Subject: Re: Non-threaded app dlopen-ing a thread-using library X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Oct 2005 08:55:56 -0000 On Oct 4, 2005, at 11:02 PM, Mikhail Teterin wrote: > Do I need to make the executable itself multi-threaded -- just in case > it needs to dlopen() a thread-using library, or is there a better way? > As long as the dlopen()ed library is correctly linked, your app doesn't need to explicitly link against the library's dependencies. Dependencies should get pulled in after dlopen() as necessary, on the fly, as a result of the dlopen()ed library's dependencies. There's nothing magical about a threaded app, as compared to a non- threaded app. The first time a pthreads API is called, libpthread initializes itself. It's fine if this happens as the result of executing dlopen()ed code; the only issue is making sure that the library dependencies are set up correctly. Jason