[PD-dev] how to load shared code for libraries

Hans-Christoph Steiner hans at at.or.at
Wed Oct 19 01:29:19 CEST 2011


On Tuesday, October 18, 2011 6:50 PM, "Hans-Christoph Steiner"
<hans at at.or.at> wrote:
> 
> On Thursday, September 29, 2011 8:49 AM, "IOhannes m zmölnig"
> <zmoelnig at iem.at> wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > On 09/28/2011 03:07 PM, Hans-Christoph Steiner wrote:
> > > 
> > > Ah, ok, that changes things.  So you are sure there isn't a way to make
> > > this work?  
> > 
> > on, i'm not sure. i only reported issues i came across.
> > 
> > > If so, do you think there are other shared library
> > > techniques you think could work? 
> > 
> > i hope, but i do not know.
> > 
> > >  Otherwise, it looks like we are back
> > > to my original manual dlopen() proposal.
> > 
> > i'm still no friend of this.
> > i'm afraid that all real-life solutions that involve dlopen(), will
> > require significantly more code to be crammed into each external (only
> > to make this work) than will be put into the "shared code library".
> > 
> > which would make the entire attempt futile.
> 
> I found something promising for GNU/Linux to complete this project:
> http://grahamwideman.wordpress.com/2009/02/09/the-linux-loader-and-how-it-finds-libraries/
> 
> DT_RUNPATH: Using the DT_RUNPATH dynamic section attribute of the binary
> if present. (Ie: the executable can provide a list of paths t search for
> objects to load. However, DT_RUNPATH is not applied at the point those
> objects load other objects. — GW)
> 
> .hc

Yes!  I got it working.  I see the way to use it for this situation,
basically set DT_RUNPATH in the .pd_linux file to the special string
$ORIGIN.  $ORIGIN is then replaced with the CWD of the .pd_linux file. 
This was the source of info that finally nailed this down for me:

http://blog.lxgcc.net/?tag=dt_runpath

The set of directories specified by a given DT_RUNPATH entry is used to
find only the immediate dependencies of the executable or shared object
containing the DT_RUNPATH entry. That is, it is used only for those
dependencies contained in the DT_NEEDED entries of the dynamic structure
containing the DT_RUNPATH entry, itself. One object's DT_RUNPATH entry
does not affect the search for any other object's dependencies. 
http://www.sco.com/developers/gabi/2000-07-17/ch5.dynamic.html#shobj_dependencies

I committed the change to tkwidgets and the template/Makefile.

.hc



More information about the Pd-dev mailing list