Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: Probleme d'interface
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Wolfgang Lux <lux@h...>
Subject: Re: Probleme d'interface

Bouzid Djamila <Bouzid.Djamila@loria.fr> writes:
> So I have mixed vendor.mli and vendor.ml in a single file vendor.ml.
> 
[ vendor.ml omitted ]
> 
> So the compilation is
> 
> finot ip 61 % cslc vendor.ml
> I/O error: vendor.cmi: No such file or directory
> finot ip 62 %
> 
> What means this error, if vendor.cmi is generated in compilation.

I guess you haven't deleted or moved away vendor.mli. Before
generating vendor.cmi from vendor.ml, the compiler first looks for a
file vendor.mli in the same directory as vendor.ml and if one is found
it assumes, that the interface file vendor.mli should be compiled
first to generate vendor.cmi. Only if that file doesn't exist, it will
generate a default interface from vendor.ml.

> 
> I have'nt inderstood why module V is not visible at all outside in this
> case of vendor.ml.                                  ^^^
> 

Just because all exported entities (types, values, modules and module
types) must also be declared in the interface specification, aka
signature of the module. Your interface did only export the module
types VENDOR and VENDOR_INTEGER, but not the module V. So it isn't
visible outside of vendor.

> > 
> > If you look into the Caml Special Light reference, 
> 
> please, could you tell me where can I find this reference ?
> I have only Caml Special Light reference manual,  I want to have
> more references of this language.

Sorry, I meant the reference manual.

[ ... ]
> 
> But if we want have 
> 
>   module V : VENDOR =
>      .......
>   end (*V*)
> 
>   module V1 = V
>   module V2 = V
> 
> or
> 
>   module V (....) : VENDOR =
>   struct
>     ......
>   end (*functor*)
> 
> What should I do ?
> 

You can simply add the following declaration to your interface file
vendor.mli:

    module V : VENDOR

or

    module  V (TimingBoard: TIMINGBOARD) : VENDOR

So the file vendor.mli, from your original posting should read:

    module type VENDOR_INTEGER = 
      sig
	val min : int * int -> int
      end (* sig *)

    module type VENDOR =
      sig
        val print: string -> unit
        module Integer : VENDOR_INTEGER
      end (* sig *)

    module V : VENDOR


Regards
Wolfgang

----
Wolfgang Lux
WZH Heidelberg, IBM Germany             Internet: lux@heidelbg.ibm.com
+49-6221-59-4546                        VNET:     LUX at HEIDELBG
+49-6221-59-3500 (fax)	                EARN:     LUX at DHDIBMIP