From owner-freebsd-current Tue Sep 1 15:16:54 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA05844 for freebsd-current-outgoing; Tue, 1 Sep 1998 15:16:54 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from zone.syracuse.net (zone.syracuse.net [205.232.47.17]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA05839 for ; Tue, 1 Sep 1998 15:16:53 -0700 (PDT) (envelope-from green@unixhelp.org) Received: from localhost (green@localhost) by zone.syracuse.net (8.8.8/8.8.7) with SMTP id PAA29089; Tue, 1 Sep 1998 15:20:45 -0400 (EDT) Date: Tue, 1 Sep 1998 15:20:45 -0400 (EDT) From: Brian Feldman X-Sender: green@zone.syracuse.net To: John Polstra cc: current@FreeBSD.ORG Subject: Re: E-day problems: rtld-elf dlsym() broken? In-Reply-To: <199809011801.LAA14263@austin.polstra.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Actually, no. The program does no munging of the input at all, it looks up with or without the _, whichever you input by typing "lookup whatever\n"... it's not my program's fault, watch: green@feldman:/home/green/C$ cc -aout -O3 dl.c -o dl -lreadline green@feldman:/home/green/C$ echo lookup main | ./dl (dl) lookup main main: 0x15ac green@feldman:/home/green/C$ cc -O3 dl.c -o dl -lreadline dline green@feldman:/home/green/C$ echo lookup main | ./dl (dl) lookup main main: not found (dl) green@feldman:/home/green/C$ Look at my source, it should work fine. -Brian On Tue, 1 Sep 1998, John Polstra wrote: > In article , > Brian Feldman wrote: > > > there is a problem now: dlsym, for me, seems to have stopped working. > > Entirely.... Returning NULL always it seems. > > I bet you're adding a leading '_' to symbols you're passing to > dlsym(), right? That used to be necessary for a.out, but it doesn't > work for ELF. It hasn't been necessary even for a.out since August, > 1997 in -current (September, 1997 in -stable). I'd recommend ditching > the underscores unconditionally. > > Here's the test program I tried, which worked: > > #include > #include > #include > > typedef int (*prf)(const char *, ...); > > int > main(int argc, char *argv[]) > { > void *h; > void *fp1; > > if ((h = dlopen("/usr/lib/libc.so.3", RTLD_LAZY)) == NULL) > errx(1, "dlopen: %s", dlerror()); > if ((fp1 = dlsym(h, "printf")) == NULL) > errx(1, "dlsym: %s", dlerror()); > (*(prf)fp1)("Hooray! It worked!\n"); > dlclose(h); > return 0; > } > > John > -- > John Polstra jdp@polstra.com > John D. Polstra & Co., Inc. Seattle, Washington USA > "Self-knowledge is always bad news." -- John Barth > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message