builing and using libraries with mercury

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jan 28 05:35:43 AEDT 1998


On 27-Jan-1998, Henk Vandecasteele <Henk.Vandecasteele at cs.kuleuven.ac.be> wrote:
> 
> Today I attempted to build a library. I don't 
> know wether this intended for simple users?

It is intended to be as easy as we can possibly make it.

> This first problem I solved by adding some extra -rpath options for ld
> and then it worked:
> ... [but executable behaved wrongly]

I don't quite understand why the link succeeded.
I think you ought to have got a multiply-defined symbol
error for the symbol `MR_runtime_grade'.

I managed to roughly duplicate what you did here, 
and the symbol `MR_runtime_grade' is indeed defined both
in the executable and in the shared library that it links in;
but `ld' does not complain.  This is arguably a bug.

Hmm, I just tested it on several platforms and the behaviour seems to be
the same :-(

I guess we can fix this by putting MR_runtime_grade (runtime/mercury_grade.c)
into a separate library, `-lmgrade' or something like that ---
and making sure that this library is never built shared.
That would ensure that you get a link error rather than an
executable which doesn't work.
Then (and this is already on the list of outstanding tasks)
we can get `mdemangle' to convert the linker error messages
into something that a "simple" user can understand.

-- 
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.



More information about the developers mailing list