Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 06 Oct 2005 01:55:30 -0700
From:      Jason Evans <jasone@canonware.com>
To:        Mikhail Teterin <mi+kde@aldan.algebra.com>
Cc:        threads@freebsd.org, jim@corebsd.or.id
Subject:   Re: Non-threaded app dlopen-ing a thread-using library
Message-ID:  <E602F495-DBE1-41E9-A0CB-6A872D575384@canonware.com>
In-Reply-To: <200510050202.36730@aldan>
References:  <200510050202.36730@aldan>

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E602F495-DBE1-41E9-A0CB-6A872D575384>