Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* [Caml-list] submodules for Dynlink plugins?
@ 2012-06-04 15:13 Dan Bensen
  2012-06-04 15:28 ` [Caml-list] " Hongbo Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Bensen @ 2012-06-04 15:13 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 413 bytes --]

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'")

And of course just adding Bar to Foo.cma
didn't work either.

[-- Attachment #2: Type: text/html, Size: 677 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Caml-list] Re: submodules for Dynlink plugins?
  2012-06-04 15:13 [Caml-list] submodules for Dynlink plugins? Dan Bensen
@ 2012-06-04 15:28 ` Hongbo Zhang
  2012-06-04 16:11   ` Dan Bensen
  0 siblings, 1 reply; 3+ messages in thread
From: Hongbo Zhang @ 2012-06-04 15:28 UTC (permalink / raw)
  To: Dan Bensen; +Cc: caml-list

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Re: submodules for Dynlink plugins?
  2012-06-04 15:28 ` [Caml-list] " Hongbo Zhang
@ 2012-06-04 16:11   ` Dan Bensen
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Bensen @ 2012-06-04 16:11 UTC (permalink / raw)
  To: Hongbo Zhang; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1730 bytes --]

> 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

[-- Attachment #2: Type: text/html, Size: 2916 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-04 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-04 15:13 [Caml-list] submodules for Dynlink plugins? Dan Bensen
2012-06-04 15:28 ` [Caml-list] " Hongbo Zhang
2012-06-04 16:11   ` Dan Bensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox