Browse thread
Using Dynlink in the top level
- David Allsopp
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | David Allsopp <dra-news@m...> |
| Subject: | Using Dynlink in the top level |
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