From: Philippe Veber <philippe.veber@googlemail.com>
To: guillaume.yziquel@citycable.ch
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Including code from a .cm[ox] into another .cm[ox]
Date: Thu, 12 Nov 2009 14:35:35 +0100 [thread overview]
Message-ID: <721f7f5a0911120535y312f659cw6edaad7512e7cd38@mail.gmail.com> (raw)
In-Reply-To: <4AFC0515.5050306@citycable.ch>
[-- Attachment #1: Type: text/plain, Size: 2109 bytes --]
You're right this is a linking issue and now the question is at which level
you want to "link" your code. I do not see the point of including a cmo in
another like you describe : i believe there are simpler and mainstream
options. Maybe I miss some details about your problem ? Using findlib to
help the linker is one way to do it, but if you insist on loading a single
module then you have two other options :
- code inclusion -> m4, camlmix, camlp4 or any preprocessor (not that ugly,
but still)
- the -pack option for combining several cmo in a single one (but then all
your modules are included in a "toplevel" module)
sorry if i still didn't get your problem ;o).
ph.
2009/11/12 Guillaume Yziquel <guillaume.yziquel@citycable.ch>
> Philippe Veber a écrit :
>
> 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 :
>>
>
> No, no, no... this is not the issue at all. My issue is not about loading
> stuff with findlib, it's about including a .cmo into another .cmo. I'd like
> to create a .cma with only a.ml, and not containing b.ml.
>
> It's not a toplevel issue, but a 'linking' issue.
>
> Thanks anyway.
>
> Guillaume.
>
>
>
>
> 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/
>>>
>>
[-- Attachment #2: Type: text/html, Size: 3428 bytes --]
next prev parent reply other threads:[~2009-11-12 13:36 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 ` [Caml-list] " Philippe Veber
[not found] ` <721f7f5a0911120441h7706cd02ud9b6b993532b88f5@mail.gmail.com>
[not found] ` <4AFC0515.5050306@citycable.ch>
2009-11-12 13:35 ` Philippe Veber [this message]
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=721f7f5a0911120535y312f659cw6edaad7512e7cd38@mail.gmail.com \
--to=philippe.veber@googlemail.com \
--cc=caml-list@yquem.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