From owner-freebsd-hackers Mon Apr 26 12: 5:30 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from cygnus.rush.net (cygnus.rush.net [209.45.245.133]) by hub.freebsd.org (Postfix) with ESMTP id 646B715277 for ; Mon, 26 Apr 1999 12:05:20 -0700 (PDT) (envelope-from bright@rush.net) Received: from localhost (bright@localhost) by cygnus.rush.net (8.9.3/8.9.3) with SMTP id OAA25961; Mon, 26 Apr 1999 14:23:00 -0500 (EST) Date: Mon, 26 Apr 1999 14:22:57 -0500 (EST) From: Alfred Perlstein To: Dan Moschuk Cc: hackers@FreeBSD.ORG Subject: Re: dlopen() and family? In-Reply-To: <19990426134633.A41603@trinsec.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, 26 Apr 1999, Dan Moschuk wrote: > > Greetings, > > I'm having a small problem with using the dlopen() interface. More > specifically, I'm not entirely sure how to compile the shared objects. > > Here are the compile options and the errors I get: > > cc -aout -c > dlopen() -- Invalid file format > > cc -Wl,-export-dynamic > dlopen() -- mmap returned wrong address: wanted ... > > cc -c > dlopen() -- Unsupported file type er, why did you not give us the complete commandline you used? On my system: .(16:01:12)(bright@thumper.reserved) ~ % cc -aout -c cc: No input files specified .(16:01:17)(bright@thumper.reserved) ~ % cc -Wl,-export-dynamic /usr/lib/crt1.o: In function `_start': /usr/lib/crt1.o(.text+0x6c): undefined reference to `main' .(16:01:23)(bright@thumper.reserved) ~ % cc -c cc: No input files specified perhaps you missed the '-shared' flag? cc -shared -o blah.so.1 obj1.o obj2.o obj3.o you probably want to compiled the object files with: cc -c obj1.c -fpic -fPIC if you are compiling a program and want its local symbols visible to dlsym(), you need the -export-dynamic flag. -Alfred To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message