From: James Scott <j.scott@runbox.com>
To: Caml List <caml-list@pauillac.inria.fr>
Subject: [Caml-list] dynlink and toplevel
Date: Thu, 3 Jun 2004 17:19:53 +0200 [thread overview]
Message-ID: <20040603151953.GE1562@piv> (raw)
Hi All,
we're doing some work where it's useful to use Dynlink in the
toplevel, but we've run into a snag: if the Dynlink-loaded module
refers to modules loaded by '#load' or on the command line, they're
not resolved. But if they're put into a 'custom' toplevel they are, e.g.
$ cat Loader.ml
let dynload_helper_ref = ref (None: int option)
let doit fname =
let _ = Dynlink.init () in
let _ = Dynlink.loadfile fname in
!dynload_helper_ref
$ cat Loadee.ml
Loader.dynload_helper_ref := Some 1
$ cat Test.ml
let _ = Loader.doit "Loadee.cmo" ;;
$ ocamlc -c Loadee.ml
$ ocamlc -a -o llib.cma Loader.ml
$ ocaml dynlink.cma llib.cma Test.ml
Exception:
Dynlink.Error
(Dynlink.Linking_error ("Loadee.cmo", Dynlink.Undefined_global "Loader")).
But this works:
$ ocamlmktop dynlink.cma llib.cma
$ ./a.out < Test.ml
Objective Caml version 3.07+2
# - : int option = Some 1
This was a bit of a surprise as I was expecting the two load semantics
to be identical... but is there any way round it?
James
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
reply other threads:[~2004-06-03 15:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20040603151953.GE1562@piv \
--to=j.scott@runbox.com \
--cc=caml-list@pauillac.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