Subject: Re: dlopen'ing a plugin that calls functions in the parent...
To: Jasper Wallace <jasper@pointless.net>
From: Oleg Polianski <Oleg.Polianski@clear.co.nz>
List: netbsd-users
Date: 09/11/2001 10:21:20
Jasper Wallace <jasper@pointless.net> writes:

> >  It could be somewhat very similar but looks slightly different (another
> >  symnum) and I still don't understand what exactly could be wrong. I'm trying
> >  to preload shared object which simply overrides some entry points in
> >  `libgdk.so' and does rendering properly (support for anti-aliasing); it
> >  tries to access some code from `libXft.so' (which is part of locally built
> >  XFree86 4.1.0) as well. But when I start the program (any gtk-based program
> >  which uses font widgets), I get the following:
> >
> > simoom p5 /opt/tmp/gdkxft-1.0 10211% LD_PRELOAD=/usr/local/lib/libgdkxft.so gfontsel
> > /usr/local/lib/libgdkxft.so: Undefined PLT symbol "XftFontOpenXlfd" (reloc type = 7, symnum = 67)
> >
> >  I recompiled both, `libXft' and `gdkxft' with `--export-dynamic' but still
> >  have no success. I went through the code, it doesn't look strange - only
> >  dlopen/dlsym/indirect call sequences, i.e. it doesn't have any callbacks and
> >  so on. Still wondering, what could be wrong, any ideas are greatly
> >  appreciated.
> 
> does
> 
> nm /path/to/libXft.whatever | grep XftFontOpenXlfd

 Yep, it does.

> show anything?
> 
> are you using -Wl,--rpath /path/to/libXft/ when you link libgdkxft.so?

 Sure. Moreover, LD_LIBRARY_PATH explicitely points to the required
 directory. 

Oleg