From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p3ENWUgR008915 for ; Fri, 15 Apr 2011 01:32:30 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4CAJeDp03RVdg2kGdsb2JhbACldQgUAQEBAQkJDQcUBCGoU4pogiOFNDCIXQEBAwaFaASNb4NzfIRhOg X-IronPort-AV: E=Sophos;i="4.64,214,1301868000"; d="scan'208";a="96978327" Received: from mail-qw0-f54.google.com ([209.85.216.54]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 15 Apr 2011 01:32:24 +0200 Received: by qwc9 with SMTP id 9so2134226qwc.27 for ; Thu, 14 Apr 2011 16:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:content-type:content-transfer-encoding :subject:date:message-id:to:mime-version:x-mailer; bh=QHayhSE2VMEK3fVOfBPN1c7V0gDit8Slr/ptCe9sS5M=; b=JQuD2HBPswQqHKgIwLB492gswY6nuOXv/3v2BQOJK8MXtzVVEysdzhUTB8j21N3tx7 6JrEgAjR1BeRgNUQqixSabuv21qr6WGTf4dUoO/EDAlj4ffQmz/Yz9mPY08UN/HSJnOA k6ajiDbbCUHAyp0W9Rkj9ciW317nd8DU89sT0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:content-type:content-transfer-encoding:subject:date:message-id :to:mime-version:x-mailer; b=GVcvuhUADRGfUvZ7kp5+LE553Bt6uVoy8THjI0wD9m5TNrU9xXMgi6+M89dIV3slk6 AVgz478J28O2O2vhQnDm7aqc0o+GDxWWkZoNpQoD3A8gPKtzVUzSXjOKh0XtB1y4sLSA eiITqm+7JpnVqK4Xs1kpeEF+DFh+/oh4DB3no= Received: by 10.229.49.140 with SMTP id v12mr1070017qcf.80.1302823943522; Thu, 14 Apr 2011 16:32:23 -0700 (PDT) Received: from [10.99.3.218] (pat160.dartmouth-secure.border2-cfw.Dartmouth.EDU [129.170.241.160]) by mx.google.com with ESMTPS id g26sm1529931qco.42.2011.04.14.16.32.17 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Apr 2011 16:32:22 -0700 (PDT) From: Alexy Khrabrov Content-Type: text/plain; charset=us-ascii Date: Thu, 14 Apr 2011 19:32:16 -0400 Message-Id: <4D64C4F9-251E-4E76-8269-361C444E8F8F@gmail.com> To: caml-list Mime-Version: 1.0 (Apple Message framework v1082) X-Mailer: Apple Mail (2.1082) Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p3ENWUgR008915 Subject: [Caml-list] swapping variant modules via subdirectories fails at link time 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