Version française
Home     About     Download     Resources     Contact us    
Browse thread
Checking an interface against an implementation
[ 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: Re: [Caml-list] Checking an interface against an implementation
Le 5 déc. 05 à 12:46, Richard Jones a écrit :

> I think the tool you're looking for is "objinfo" -- on Linux it's
> usually installed as "ocamlobjinfo".  However this tool only works on
> .cmi's or .cmo's, not .cmx's.

Thanks for the info (however note that this tool doesn't seem to be  
installed by default, at least if you compile from the source).

However I think what I want to do is impossible, apparently cmo  
record the cmi they were compiled with (in my case the one  
automatically generated) and refuse to link if the client was  
compiled with a different cmi. In other words a .cmo can have only  
one .cmi, is that true ?

One way to achieve what I want is to do the following

mylib/a.ml
mylib/b.ml
mylib/mylib.ml
mylib/mylib.mli

Such that mylib.ml is :

module A = A
module B = B

and mylib.mli defines the constrained interfaces :

module A = sig ... end
module B = sig ... end

But I have the following two questions. Suppose I pack the objects  
files into a cma and cmxa,

1) Is there any performance impact when the client uses functions  
from A or B via Mylib ? Does it introduce an indirection ?

2) Don't I lose the benefit of cm(x)a ? I have the impression that  
here, even if the client uses only functions from Mylib.A, b.cmo (or  
b.cmx) will also be linked in. Is that right ?

Daniel