From owner-freebsd-ports Sun May 12 21:50:21 1996 Return-Path: owner-ports Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id VAA16146 for ports-outgoing; Sun, 12 May 1996 21:50:21 -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 VAA16141 for ; Sun, 12 May 1996 21:50:18 -0700 (PDT) Received: from thurston.eng.umd.edu (thurston.eng.umd.edu [129.2.98.206]) by distortion.eng.umd.edu (8.7.5/8.7.3) with ESMTP id AAA19516 for ; Mon, 13 May 1996 00:50:16 -0400 (EDT) Received: (from chuckr@localhost) by thurston.eng.umd.edu (8.7.5/8.7.3) id AAA05825; Mon, 13 May 1996 00:50:14 -0400 (EDT) Date: Mon, 13 May 1996 00:50:13 -0400 (EDT) From: Chuck Robey X-Sender: chuckr@thurston.eng.umd.edu To: FreeBSD Ports Subject: dynamic linking Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-ports@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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.