Version franaise
Home About Download Resources Contact us
Browse thread
Dynlinking plugins defining the same unit name but with different implementations.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel_Bünzli <daniel.buenzli@e...>
Subject: Dynlinking plugins defining the same unit name but with different implementations.
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.