From: Guillaume Yziquel <guillaume.yziquel@citycable.ch>
To: OCaml List <caml-list@inria.fr>
Subject: Controlling module loading order.
Date: Fri, 08 Jan 2010 21:54:59 +0100 [thread overview]
Message-ID: <4B479BA3.6060300@citycable.ch> (raw)
Hi.
I've been reimpleminting the OCaml-R binding, and implemented a simple
wrapper around the Quantmod package in R:
http://yziquel.homelinux.org/gitweb/?p=ocaml-r.git;a=tree
http://yziquel.homelinux.org/gitweb/?p=ocamlr-quantmod.git;a=tree
Testing these modules from the toplevel is quite fine. However, when
compiling stuff using these pieces of code, I have issues with the way
the modules are loaded, since the order in which they are loaded has
side-effects: Initialisation of the R interpreter in the good case,
segfaults in the bad case...
For instance, the META file of OCaml-R:
> 1 name = "R"
> 2 version = "0.2"
> 3 description = "R bindings for OCaml"
> 4 requires = "unix"
> 5 archive(byte) = "r.cma"
> 6 archive(native) = "r.cmxa"
> 7
> 8 package "interpreter" (
> 9 version = "0.2"
> 10 description = "Embedded R interpreter"
> 11 requires = "R"
> 12 archive(byte) = "oCamlR.cma"
> 13 archive(native) = "oCamlR.cmxa"
> 14 )
The stub functions are in package "R", and package "R.interpreter"
contains a module with and empty signature, whose side-effects are to
initialise the R interpreter through an application of the functor
> 19 module Interpreter (Env : Environment) : Interpreter = struct
> 20
> 21 let () = init ~name: Env.name
> 22 ~argv: Env.options
> 23 ~env: Env.env
> 24 ~sigs: Env.signal_handlers
> 25 ()
> 26
> 27 end
My issue concerns the Quantmod wrapper: How can I make sure that when
the Quantmod module is loaded, the OCamlR module of the "R.interpreter"
findlib package gets loaded before?
Currently the ocamlbuild _tags file for ocamlr-quantmod is
> 1 <quantmod.ml>: pkg_R.interpreter, pkg_CRAN-zoo
But that doesn't seem to do the trick...
My question is: do I have to put a line like "module X = OCamlR" in
quantmod.ml, or is there a way to load OCamlR beforehand just by
tweaking the build process, order of modules when linking, etc...
All the best,
--
Guillaume Yziquel
http://yziquel.homelinux.org/
next reply other threads:[~2010-01-08 20:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-08 20:54 Guillaume Yziquel [this message]
2010-01-09 8:22 ` [Caml-list] " Stéphane Glondu
2010-01-11 11:59 ` Gerd Stolpmann
2010-01-11 17:49 ` Guillaume Yziquel
2010-01-15 17:31 ` Guillaume Yziquel
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=4B479BA3.6060300@citycable.ch \
--to=guillaume.yziquel@citycable.ch \
--cc=caml-list@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