From owner-freebsd-ports Mon May 13 11:17:47 1996 Return-Path: owner-ports Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id LAA10198 for ports-outgoing; Mon, 13 May 1996 11:17:47 -0700 (PDT) Received: from palmer.demon.co.uk (palmer.demon.co.uk [158.152.50.150]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id LAA10190 for ; Mon, 13 May 1996 11:17:31 -0700 (PDT) Received: from palmer.demon.co.uk (localhost [127.0.0.1]) by palmer.demon.co.uk (sendmail/PALMER-1) with ESMTP id SAA14531 ; Mon, 13 May 1996 18:54:40 +0100 (BST) To: Chuck Robey cc: FreeBSD Ports From: "Gary Palmer" Subject: Re: dynamic linking In-reply-to: Your message of "Mon, 13 May 1996 00:50:13 EDT." Date: Mon, 13 May 1996 18:54:40 +0100 Message-ID: <14528.832010080@palmer.demon.co.uk> Sender: owner-ports@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Chuck Robey wrote in message ID : > 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? My first guess would be that you aren't using a linked shared library, but rather the component of one. Try using dlopen() on something like /usr/lib/libncurses.so.2.0 and see if that works (after checking that I got the filename right :-) ) I have an example program here which (worst case) dlopen()s about, umm, 7 or 8 libraries before it does ANYTHING else, so I know that it works :-) Gary -- Gary Palmer FreeBSD Core Team Member FreeBSD - Turning PC's into workstations. See http://www.FreeBSD.ORG/ for info.