*BSD News Article 81300


Return to BSD News archive

Newsgroups: comp.unix.bsd.freebsd.misc
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!howland.erols.net!newsfeed.internetmci.com!news.webspan.net!ix.netcom.com!netcom.net.uk!news.u-net.com!yama.mcc.ac.uk!news.salford.ac.uk!aber!bath.ac.uk!ccsmh
From: ccsmh@bath.ac.uk (Mark Harding)
Subject: [Help] Dynamic Link libraries
Organization: Bath University Computing Services, UK
Message-ID: <Dzo4KJ.A96.B.ss1@bath.ac.uk>
Date: Tue, 22 Oct 1996 08:21:55 GMT
Lines: 33

Hi,

I'm hoping someone can shed light on this because I'm at the end of my
tether :-(  I've looked everywhere I can think of.

The problem is this:  I have a small program that uses the dlopen(),
dlsym() etc functions to access functions in a Dynamic Library.  I can
get this test program to run under SunOs and Linux but not under FreeBSD.

The closest I get is

   mprotect failed for "./libadd.so" : Invalid argument: ./libadd.so

when I run the program and yet the very same test works perfectly on the
the other systems (albeit with different compiler options)

Can someone please correct the two makefile rules below or otherwise 
explain how to build these things under FreeBSD.

Thanks in advance!

Mark

--[ Makefile ]---------------------------------------------------------------

all: tester libadd.so

tester:
	gcc tester.c -o tester /usr/libexec/ld.so

libadd.so: libadd.c Makefile
	gcc -fPIC -r -shared -o libadd.so libadd.c