Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "David Allsopp" <dra-news@metastack.com>
To: "OCaml List" <caml-list@yquem.inria.fr>
Subject: Using Dynlink in the top level
Date: Wed, 15 Apr 2009 12:25:27 +0200	[thread overview]
Message-ID: <006901c9bdb4$81979e10$84c6da30$@com> (raw)

Is there any way to allow modules loaded with Dynlink in the top-level to
have access to modules loaded using #load?

For example, suppose I have bar.cmo which depends on foo.cmo. If I say:

        Objective Caml version 3.11.0
# #load "dynlink.cma";;
# #load "foo.cmo";;
# Dynlink.openfile "bar.cmo";;

then I get:

Exception:
Dynlink.Error
 (Dynlink.Linking_error ("bar.cma", Dynlink.Undefined_global "Foo")).

I can work around this by either:

a) Using Dynlink.openfile instead of #load to load foo.cmo
b) Using ocamlmktop and pre-linking foo.cmo into a new top-level

Method a) would be fine except that Dynlink cannot load libraries like
unix.cma so ocamlmktop becomes the only (slightly tedious) alternative if
libs like unix.cma is required. Presumably the code for the top-level uses
for #load and Dynlink must be almost the same thing so it seems long-winded
to have use ocamlmktop all the time...


David


                 reply	other threads:[~2009-04-15 10:25 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='006901c9bdb4$81979e10$84c6da30$@com' \
    --to=dra-news@metastack.com \
    --cc=caml-list@yquem.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