Hi Pietro,

On Wed, Sep 04, 2013 at 05:55:23PM +0200, Pietro Braione wrote:
> $ ocamlbuild -use-ocamlfind -package cil foo.cma foo.cmxs
> + /usr/bin/ocamlfind ocamlc -c -package cil -o foo.cmo foo.ml
> File "foo.ml", line 23, characters 10-27:
> Error: Unbound module Simplemem
> Command exited with code 2.
> Compilation unsuccessful after building 2 targets (0 cached) in 00:00:00.
> 
> How do I invoke a feature from another one? In the case my question
> denotes complete ignorance of OCaml I admit my fault, but still kindly
> ask for some hint.

1) In order to compile your module, you need to tell ocamlbuild you are
using the simplemem plugin. You can use:

$ ocamlbuild -use-ocamlfind -pkgs cil,cil.simplemem foo.cma foo.cmxs

Note that if your command-line invocation grows too much, you can write
a _tags file to drive ocamlbuild (you'll still need the -use-ocamlfind
flag though):

$ cat _tags
<foo.*>: package(cil), package(cil.simplemem)

Of course, you are not limited to Simplemem, or even to CIL plugins:
this technique works to link any OCaml library installed with ocamlfind.

2) To use your plugin, you also need to load cil.simplemem. You can
either use:

$ cilly -load cil.simplemem -load foo.cmxs

or, if you install your plugin with ocamlfind, add the following line to
your META file:

requires = "cil.simplemem"

Note that order matters if you use the command-line option. The
advantage of the META file is that ocamlfind figures out the right
dependency order for you (and it's more concise of course).

Let me know if this solves your issue. I'll try and update the gist at
some point with your example.

Best regards,
-- 
Gabriel

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to