From owner-freebsd-current Mon May 13 07:42:41 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id HAA24970 for current-outgoing; Mon, 13 May 1996 07:42:41 -0700 (PDT) Received: from distortion.eng.umd.edu (distortion.eng.umd.edu [129.2.98.6]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id HAA24963 for ; Mon, 13 May 1996 07:42:37 -0700 (PDT) Received: from ginger.eng.umd.edu (ginger.eng.umd.edu [129.2.98.204]) by distortion.eng.umd.edu (8.7.5/8.7.3) with ESMTP id KAA25607 for ; Mon, 13 May 1996 10:42:35 -0400 (EDT) Received: (from chuckr@localhost) by ginger.eng.umd.edu (8.7.5/8.7.3) id KAA03249; Mon, 13 May 1996 10:42:34 -0400 (EDT) Date: Mon, 13 May 1996 10:42:34 -0400 (EDT) From: Chuck Robey X-Sender: chuckr@ginger.eng.umd.edu To: FreeBSD Current Subject: Re: dynamic linking In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk On Mon, 13 May 1996, Chuck Robey wrote: I put this on ports, but I had it suggested to me that current was a better forum, since I wasn't getting any response from ports. > One more time, in case you missed it. If I don't get an answer this > time, I'll stop bugging you. I am working on getting the tcl code to > dynamically load modules, and to do that I'm trying to understand the > dlopen/dlsym calls. I wrote a very simple program to test it, which just > takes a file from the command line and dloads it. To use a file I knew > was in correct format, I used one from libc, but I always get this kind > of error: > > ./dltests /usr/obj/lib/libc/rmdir.so > testing file /usr/obj/lib/libc/rmdir.so ... dlopen call returned pointer > value 0 > dlerror call returns mmap failed for "/usr/obj/lib/libc/rmdir.so" : > Invalid argument > > OK, below is the code I wrote to test it. Anyone got any idea why it's > failing? > > Thanks. > > #include > #include > > void main( int argc, char *argv[] ) > { > int err_ret; > void *pntr; > > if( argc != 2 ) > { > printf("%s: incorrect number of parameters.\n",argv[0]); > printf("\tInvoke as: %s \n",argv[0]); > exit(0); > } > printf("testing file %s ... ", argv[1]); > pntr = dlopen( argv[1], 1 ); > printf("dlopen call returned pointer value %lx\n", pntr ); > printf("dlerror call returns %s\n", dlerror() ); > if( pntr ) > { > err_ret = dlclose( pntr ); > printf("since open was successful, dlclose returns %d\n", > err_ret ); > printf("and subsequent dlerror call returns %s\n",dlerror()); > } > exit(0); > } > > > ========================================================================== > Chuck Robey chuckr@eng.umd.edu, I run FreeBSD-current on n3lxx + Journey2 > > Three Accounts for the Super-users in the sky, > Seven for the Operators in their halls of fame, > Nine for Ordinary Users doomed to crie, > One for the Illegal Cracker with his evil game > In the Domains of Internet where the data lie. > One Account to rule them all, One Account to watch them, > One Account to make them all and in the network bind them. > > > ========================================================================== Chuck Robey chuckr@eng.umd.edu, I run FreeBSD-current on n3lxx + Journey2 Three Accounts for the Super-users in the sky, Seven for the Operators in their halls of fame, Nine for Ordinary Users doomed to crie, One for the Illegal Cracker with his evil game In the Domains of Internet where the data lie. One Account to rule them all, One Account to watch them, One Account to make them all and in the network bind them.