> create a foo.mllib

I tried that.  Are you sure it works with
camlp4/Dynlink?  Foo needs to have access
to Bar when the callback functions are called.
They're not just separate plugins that are
packaged together, they form a single plugin.

Foo defines a module that gets passed to a
functor in Bar, and the module definition and
the call to the functor are both wrapped in
a functor that gets passed to Register.Plugin.
(Foo = MetlString and Bar = Metl from the
"interface mismatch" thread.)
The problem seems to be that Dynlink can only
handle one module at a time.



From: Hongbo Zhang <bobzhang1988@gmail.com>
To: Dan Bensen <danbensen@att.net>
Cc: caml-list@inria.fr
Sent: Mon, June 4, 2012 5:29:12 PM
Subject: [Caml-list] Re: submodules for Dynlink plugins?

On 6/4/12 11:13 AM, Dan Bensen wrote:
> How do you include module Bar inside module Foo
> so you can load Foo as a Dynlink plugin (for camlp4)?
> I tried adding a line in Foo.ml that says
>
>  > module Bar = struct include Bar end
>
> but camlp4 still didn't like it:
>
>  > Camlp4: Uncaught exception: DynLoader.Error
>  > ("Foo.cmo", "error while linking Foo.cmo.
>  > Reference to undefined global `Bar'")
create a foo.mllib
cat foo.mllib
bar
foo
then link foo.cma

dobule check
ocamlobjinfo foo.cma | grep Unit
the output should contain only Foo, Bar

tip: be careful for camlp4, don't link modules which has side effect twice.
>
> And of course just adding Bar to Foo.cma
> didn't work either.


--
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs