From: Jean-Baptiste Jeannin <jeannin@cs.cornell.edu>
To: "Jérémie Dimino" <jeremie@dimino.org>
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: RE: [Caml-list] Exception Typetexp.Error(_, _) when using Toploop
Date: Sat, 11 Aug 2012 16:15:24 -0400 [thread overview]
Message-ID: <A7FC6DE86AF33142A1FA4CE04EEBF4F18591C6186B@gobo.cs.cornell.edu> (raw)
In-Reply-To: <20120811103435.3362ceec@locris.home>
Hi Jeremie and thanks for your answer,
If I understand correctly you suggest two possible fixes:
First possible fix, copy tree.cmi one level up. I don't like this solution too much but it works:
$ ocamlc -o prog.exe -I subdir toplevellib.cma subdir/tree.ml prog.ml
$ ./prog.exe
Fatal error: exception Typetexp.Error(_, _)
$ cp subdir/tree.cmi .
$ ./prog.exe
val t : Tree.tree = Tree.Leaf
Second possible fix, add the line 'Topdirs.dir_directory "subdir";' to prog.ml. This works great, I prefer it and it solves my problem. Thanks a lot!
________________________________________
From: caml-list-request@inria.fr [caml-list-request@inria.fr] On Behalf Of Jérémie Dimino [jeremie@dimino.org]
Sent: Saturday, August 11, 2012 4:34 AM
To: Jean-Baptiste Jeannin
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Exception Typetexp.Error(_, _) when using Toploop
Le Fri, 10 Aug 2012 17:30:26 -0400,
Jean-Baptiste Jeannin <jeannin@cs.cornell.edu> a écrit :
> $ cd ..
> $ ocamlc -o prog.exe -I subdir toplevellib.cma subdir/tree.ml prog.ml
> $ ./prog.exe
> Fatal error: exception Typetexp.Error(_, _)
It is because it cannot find the interface for the module Tree (which
is contained in the file tree.cmi). If you want to compile code at
runtime using compiler libraries you need all .cmi for all units you
are using in this code.
You can add new search paths using Topdirs.dir_directory, which
correspond to the #directory directive in the toplevel.
Cheers,
--
Jérémie
--
Caml-list mailing list. Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
prev parent reply other threads:[~2012-08-11 20:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-10 21:30 Jean-Baptiste Jeannin
2012-08-11 0:14 ` [Caml-list] " Hongbo Zhang
2012-08-11 20:03 ` [Caml-list] " Jean-Baptiste Jeannin
2012-08-11 8:34 ` [Caml-list] " Jérémie Dimino
2012-08-11 20:15 ` Jean-Baptiste Jeannin [this message]
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=A7FC6DE86AF33142A1FA4CE04EEBF4F18591C6186B@gobo.cs.cornell.edu \
--to=jeannin@cs.cornell.edu \
--cc=caml-list@inria.fr \
--cc=jeremie@dimino.org \
/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