caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
To: caml-list List <caml-list@yquem.inria.fr>
Subject: Dynlinking plugins defining the same unit name but with different  implementations.
Date: Thu, 1 Jul 2010 21:01:34 +0200	[thread overview]
Message-ID: <AANLkTilISu1bWwWj305NhqJTTuFuIUOTF8d5RoNF9Csp@mail.gmail.com> (raw)

Hello,

On osx 10.6.4 with ocaml 3.12.0+beta1

Suppose I have two following two plugins

a.cmxs, containing a/a.cmx using M.test and a/m.cmx defining M.test
b.cmxs, containing b/b.cmx using M.test and M.test2 and b/m.cmx
defining M.test and M.test2

of course a/m.cmx and b/m.cmx are different implementations except
they define the same interface for M.test

If I Dynlink.loadfile or Dynlink.loadfile_private first a.cmxs and
then b.cmxs there are no errors reported and b uses M.test of a/m.cmx
but M.test2 of b/m.cmx (since the m.cmx in a.cmxs doesn't define it)

Is that expected behaviour ? That looks like dll hell.

Best,

Daniel

P.S. Here's how the plugins are constructed and an invocation of a
test program to give an idea :

> > ocamlbuild a.cmxs b.cmxs test.native
> /usr/local/bin/ocamlopt.opt -shared a/m.cmx a/a.cmx -o a/a.cmxs
> /usr/local/bin/ocamlopt.opt -shared b/m.cmx b/b.cmx -o b/b.cmxs

> > ./test.native
> A using M.test in a/m.ml
> B using M.test in a/m.ml and M.test2 b/m.ml

The last line should be

> B using M.test in b/ml.ml and M.test2 b/m.ml

or some kind of error should be reported.


             reply	other threads:[~2010-07-01 19:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-01 19:01 Daniel Bünzli [this message]
2010-07-01 19:16 ` Daniel Bünzli
2010-07-02  8:07   ` [Caml-list] " Alain Frisch
2010-07-02  8:27     ` Daniel Bünzli
2010-07-02  8:40       ` Alain Frisch
2010-07-02  8:47         ` Alain Frisch
2010-07-02  9:19           ` Daniel Bünzli
2010-07-02 17:48             ` Daniel Bünzli
2010-07-05  7:27               ` Alain Frisch
2010-07-05 11:15                 ` Daniel Bünzli
2010-07-05 11:41               ` Alain Frisch

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=AANLkTilISu1bWwWj305NhqJTTuFuIUOTF8d5RoNF9Csp@mail.gmail.com \
    --to=daniel.buenzli@erratique.ch \
    --cc=caml-list@yquem.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;
as well as URLs for NNTP newsgroup(s).