Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* Using Dynlink in the top level
@ 2009-04-15 10:25 David Allsopp
  0 siblings, 0 replies; only message in thread
From: David Allsopp @ 2009-04-15 10:25 UTC (permalink / raw)
  To: OCaml List

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-15 10:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-15 10:25 Using Dynlink in the top level David Allsopp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox