Version française
Home     About     Download     Resources     Contact us    
Browse thread
Including code from a .cm[ox] into another .cm[ox]
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Philippe Veber <philippe.veber@g...>
Subject: Re: [Caml-list] Including code from a .cm[ox] into another .cm[ox]
Hi

maybe you can have a look at findlib and its #require statement. For
instance, pxp (xml related library) depends on many cma, but everything
loads automagically when invoking #require :


        Objective Caml version 3.11.1

# #use "topfind";;
- : unit = ()
Findlib has been successfully loaded. Additional directives:
  #require "package";;      to load a package
  #list;;                   to list the available packages
  #camlp4o;;                to load camlp4 (standard syntax)
  #camlp4r;;                to load camlp4 (revised syntax)
  #predicates "p,q,...";;   to set these predicates
  Topfind.reset();;         to force that packages will be reloaded
  #thread;;                 to enable threads

- : unit = ()
# #require "pxp";;
/home/pveber/usr/lib/godi/lib/ocaml/pkg-lib/pcre: added to search path
/home/pveber/usr/lib/godi/lib/ocaml/pkg-lib/pcre/pcre.cma: loaded
/home/pveber/usr/lib/godi/lib/ocaml/std-lib/unix.cma: loaded
/home/pveber/usr/lib/godi/lib/ocaml/pkg-lib/netsys: added to search path
/home/pveber/usr/lib/godi/lib/ocaml/pkg-lib/netsys/netsys.cma: loaded
/home/pveber/usr/lib/godi/lib/ocaml/pkg-lib/netstring: added to search path
[...]
/home/pveber/usr/lib/godi/lib/ocaml/pkg-lib/pxp-ulex-utf8/pxp_ulex_link_utf8.cmo:
loaded
/home/pveber/usr/lib/godi/lib/ocaml/pkg-lib/pxp: added to search path
# Pxp_document.liquefy;;
- : ?omit_end:bool ->
    ?omit_positions:bool ->
    (< clone : 'a; node : 'a Pxp_document.node;
       set_node : 'a Pxp_document.node -> unit; .. >
     as 'a)
    Pxp_document.solid_xml -> 'b -> Pxp_types.event option
= <fun>

hth,
ph.


2009/11/12 Guillaume Yziquel <guillaume.yziquel@citycable.ch>

> Hello.
>
> Imagine I have a file named a.ml containing
>
>  module C = struct
>>  include B
>> end
>>
>
> and a file named b.ml containing the code
>
>  let f x = x + 1
>>
>
> When I compile everything to .cmo files, I cannot load a.cmo from the
> toplevel without loading b.cmo beforehand.
>
> Is there a way to make the 'include B' statement to include the code of the
> B module in the C submodule directly so that it is not required to load the
> b.cmo file before loading the a.cmo file?
>
> That would be extremely useful to me...
>
> All the best,
>
> --
>     Guillaume Yziquel
> http://yziquel.homelinux.org/
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>