caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Philippe Veber <philippe.veber@googlemail.com>
To: guillaume.yziquel@citycable.ch
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Including code from a .cm[ox] into another .cm[ox]
Date: Thu, 12 Nov 2009 13:41:45 +0100	[thread overview]
Message-ID: <721f7f5a0911120441q6f41d36bhf794d32966f57522@mail.gmail.com> (raw)
In-Reply-To: <4AFBFC9E.8010802@citycable.ch>

[-- Attachment #1: Type: text/plain, Size: 2595 bytes --]

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
>

[-- Attachment #2: Type: text/html, Size: 3912 bytes --]

  reply	other threads:[~2009-11-12 12:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-12 12:16 Guillaume Yziquel
2009-11-12 12:41 ` Philippe Veber [this message]
     [not found] ` <721f7f5a0911120441h7706cd02ud9b6b993532b88f5@mail.gmail.com>
     [not found]   ` <4AFC0515.5050306@citycable.ch>
2009-11-12 13:35     ` [Caml-list] " Philippe Veber
2009-11-12 14:16       ` Guillaume Yziquel

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=721f7f5a0911120441q6f41d36bhf794d32966f57522@mail.gmail.com \
    --to=philippe.veber@googlemail.com \
    --cc=caml-list@inria.fr \
    --cc=guillaume.yziquel@citycable.ch \
    /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).