dlsym can't use handle returned by dlopen?

Jeremy Chadwick koitsu at FreeBSD.org
Thu Nov 13 04:18:24 PST 2008


On Thu, Nov 13, 2008 at 12:24:02AM -0800, Jeremy Chadwick wrote:
> On Thu, Nov 13, 2008 at 09:20:59AM +0100, Markus Hoenicka wrote:
> > Quoting Jeremy Chadwick <koitsu at FreeBSD.org>:
> >
> >> When I looked at the resulting symbol names using nm or objdump, certain
> >> characters were prepended to them.  There's a gcc or ld flag which
> >> disables this behaviour.  I'll have to dig around to remind myself what
> >> it is.  Once I read about it, it made perfect sense.
> >>
> >> Again, if you want me to write some code and provide some output of
> >> what I'm talking about, I can do so.
> >>
> >
> > I'd greatly appreciate any help here. I feel what I'm doing now is  
> > writing ugly hacks to make things work somehow. I'd prefer to do it  
> > properly.
> 
> No problem.  I'll try to get something small/simple written up tonight
> (I'm at work right now) and send it out.

As promised: http://www.malkavian.com/~jdc/myprog.tar.gz

I couldn't figure out what the gcc flag was that I needed to keep
certain characters from getting prepended to the symbol names.  I
believe the char added was an underscore, but I could be wrong.

Either way, the example should help you, I think.  (You can change
RTLD_LAZY to RTLD_NOW and it still functions as expected)

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |



More information about the freebsd-questions mailing list