From: kahl@heraklit.informatik.UniBw-Muenchen.de
To: caml-list@inria.fr
Cc: Pierre.Weis@inria.fr
Subject: Why does the order in the Makefile matter? --- Linking with C
Date: 30 Oct 2000 08:30:14 -0000 [thread overview]
Message-ID: <20001030083014.31396.qmail@dionysos.informatik.unibw-muenchen.de> (raw)
In-Reply-To: <200010281655.SAA31819@pauillac.inria.fr> (message from Pierre Weis on Sat, 28 Oct 2000 18:55:08 +0200 (MET DST))
Pierre Weis <Pierre.Weis@inria.fr> wrote:
> Hence, when the entire program is made of multiple implementation
> files, those files must be linked in any order that is compatible with
> the static binding rule: no definition can be linked if it refers to
> an identifier that is defined after the definition at hand. In
> addition, expressions to be computed must evidently appear in any
> order compatible with the desired runtime behaviour.
However, yesterday I experimented with implementing a system call in C
(why does the standard library only provide sleep with a granularity of
whole seconds?),
and I linked it together with the .cmx file containing the external definition
into utils.cmxa.
Then I proceeded to link my application, consisting of other *.ml modules
that use stuff from utils.cmxa, including that external function:
ocamlopt ... -o application utils.cmxa others1*.cmxa others2*.cmx
The result was a link error that the system call could not be found.
(The analogous bytecode variant compiles without complaints,
but I only use the bytecode compiler as a kind of ``lint''.)
So I had to take utilsC.o out of utils.cmxa and revert to:
ocamlopt ... -o application utils.cmxa others1*.cmxa others2*.cmx utilsC.o
This is logical with my understanding of C linking,
but I would prefer not to have to use that knowledge... ;-)
Is this asymmetry known/documented/on purpose?
Best regards,
Wolfram Kahl
next prev parent reply other threads:[~2000-10-30 11:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-10-28 8:01 Why does the order in the Makefile matter? Mattias Waldau
2000-10-28 16:55 ` Pierre Weis
2000-10-30 8:30 ` kahl [this message]
2000-10-31 7:39 ` Mattias Waldau
2000-11-01 7:38 ` Stephan Houben
2000-11-02 18:22 ` Pierre Weis
2000-11-03 7:24 ` Judicael Courant
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20001030083014.31396.qmail@dionysos.informatik.unibw-muenchen.de \
--to=kahl@heraklit.informatik.unibw-muenchen.de \
--cc=Pierre.Weis@inria.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).