[mercury-users] dynamic linking..

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Oct 16 02:03:14 AEST 1999


On 16-Oct-1999, Robert Ernst Johann JESCHOFNIK <rejj at cat.cs.mu.OZ.AU> wrote:
> 
> I just uncovered something a bit odd whilst playing with dynamic linking
> on my linux system.
> If I set the following flag in the Mmakefile:
> (along with EXTRA_MLFLAGS = -shared  in both cases)
> 
> MGNUCFLAGS    = -DML_OMIT_ARRAY_BOUNDS_CHECKS --pic-reg
> 
> I get this error during make (whilst mgnuc is running)
> cc1: Invalid option `-fpic-reg'
> 
> However, with the two flags reversed,
> MGNUCFLAGS    = --pic-reg -DML_OMIT_ARRAY_BOUNDS_CHECKS
> 
> I get no such error, and everything compiles just fine. Is there any
> particular reason for this?

`--pic-reg' is an mgnuc option, whereas `-D' is a gcc option.
The mgnuc script assumes that its command line contains a sequence
of mgnuc options followed by a sequence of gcc options.
Either of these sequences can be empty.
But gcc options cannot precede mgnuc options on the command line.

An alternative approach which avoids the ordering problem is to use
`CFLAGS' for gcc options and `MGNUCFLAGS' for mgnuc options.

	MGNUCFLAGS = --pic-reg
	CFLAGS = -DML_OMIT_ARRAY_BOUNDS_CHECKS

I notice that the documentation in library/array.m which mentions the
`-DML_OMIT_ARRAY_BOUNDS_CHECKS' option suggests using `MGNUCFLAGS'
rather than `CFLAGS'.  I will change it.  Thanks for the feedback.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list