From: Alexy Khrabrov <deliverable@gmail.com>
To: caml-list <caml-list@inria.fr>
Subject: [Caml-list] swapping variant modules via subdirectories fails at link time
Date: Thu, 14 Apr 2011 19:32:16 -0400 [thread overview]
Message-ID: <4D64C4F9-251E-4E76-8269-361C444E8F8F@gmail.com> (raw)
I have a module a.ml, containing some functions I want to alter in a version of my program. I'd like to do it on the command line at link time, to obtain either the original, or an altered version.
Here's the original make line, simplified:
%.cmx: %.ml
ocamlfind ocamlopt $(DEBUG) $(OPTFLAGS) -package $(PACKAGES) -c $^ -o $@
prog.opt: lib.cmxa a.cmx x.cmx prog.ml
ocamlfind ocamlopt $(DEBUG) $(OPTFLAGS) -package $(PACKAGES) -linkpkg $^ -o $@
I tried to create the variant by placing an altered version of a.ml in a subdirectory, var/, and linking that:
prog.var.opt: lib.cmxa var/a.cmx x.cmx prog.ml
ocamlfind ocamlopt $(DEBUG) $(OPTFLAGS) -package $(PACKAGES) -linkpkg $^ -o $@
Further, I've created a.mli at the root level, and compiled it with
ocamlfind ocamlc a.mli
-- it needs lib.cmo to work, a byte-code version of lib.cmxa, which I make first.
With that a.cmi at the root level, I can remake prog.opt fine. If I copy or symlink a.cmi to var/, or symlink a.mli there, and try to make prog.var.opt, I get an error at prog.ml that files var/a.cmx and x.cmx make inconsistent assumptions about the interface A.
The var/a.cmx is made by the same above pattern rule as ./a.cmx. Even when ./a.cmi and var/a.cmi are the same, the same inconsistent error shows up! Renaming ./a.ml out of the way and symlinking var/a.ml to ./ remakes prog.opt fine, which I can then rename prog.var.opt manually and hope to do it every time I need that, yet it's tiresome. What prevents the original scheme from working?
-- Alexy
next reply other threads:[~2011-04-14 23:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-14 23:32 Alexy Khrabrov [this message]
2011-04-15 8:37 ` Goswin von Brederlow
2011-04-17 20:26 ` Alexy Khrabrov
2011-04-17 20:49 ` Stéphane Glondu
2011-04-19 17:09 ` Alexy Khrabrov
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=4D64C4F9-251E-4E76-8269-361C444E8F8F@gmail.com \
--to=deliverable@gmail.com \
--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