Brilliant, thank you very much for the detailed answers, Gabriel.

Since I am using Python to execute the Cilly driver, I managed to find a way to dynamically set the environment variable OCAMLPATH (albeit temporarily) from within my Python script, and it works beautifully once the OCaml code has been compiled.

Thanks again,

On 9 October 2013 12:52, Gabriel Kerneis <> wrote:
On Wed, Oct 09, 2013 at 10:07:49AM -0700, Jonathan Kotker wrote:
> Looking at your commands below, it looks like the 'MYLIBDIR' environment
> variable is being hardwired to a location on my computer. Would this
> transmute appropriately on other machines? Or does it not matter?

So, all you need is an absolute path. If you have a way to find dynamically
where the user installed the plugins, and set OCAMLPATH to that, everything
will work correctly (note that OCAMLPATH is used at runtime, whereas
OCAMLFIND_DESTDIR is used at compile time to gather the relevant files into the
library directory).

Also note that findlib always has some hard-coded default directories. I don't
know what they are on Windows (and it might even depend on your compilation
toolchain), but if you manage to find out their value, you could install your
plugins directly in them, and you wouldn't have to setup OCAMLPATH at all.  This
will work even if findlib is not installed on your target machine, since the
value is defined when findlib is configured (or your host machine), and then
linked statically with findlib into cilly.

Read carefully the manpage of findlib.conf for more details.

> Also, yes, I am using the bin/cilly Perl wrapper.

bin/cilly tries to locate ../share/cil/ocamlpath. If the file exists, it will
append its content to OCAMLPATH automatically.  So yet another option is to make
sure this file contains the correct absolute path when you install on cilly on
your target machine.  You can tweak the path of this file easily by modifying
bin/cilly (for instance if you'd rather have it installed in the same directory
as cilly itself, rather than in ../share/cil).

As you can see, there are many options.  It depends a lot on how your software
is distributed and installed.  The bottom-line, however, is that you need to
(dynamically) figure out the absolute path to your plugin directory.