Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Apr 1999 14:22:57 -0500 (EST)
From:      Alfred Perlstein <bright@rush.net>
To:        Dan Moschuk <dan@trinsec.com>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: dlopen() and family?
Message-ID:  <Pine.BSF.3.96.990426141757.2095w-100000@cygnus.rush.net>
In-Reply-To: <19990426134633.A41603@trinsec.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.990426141757.2095w-100000>