From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 92C67BC37 for ; Thu, 12 Nov 2009 15:16:11 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmYCAPem+0pV2gB4h2dsb2JhbACEdJcnAQEBCgsIBxWvNZB4gTCCOFQEgWyGOw X-IronPort-AV: E=Sophos;i="4.44,728,1249250400"; d="scan'208";a="36628115" Received: from emailfrontal1.citycable.ch ([85.218.0.120]) by mail2-smtp-roc.national.inria.fr with SMTP; 12 Nov 2009 15:16:11 +0100 Received: from [192.168.0.10] (unknown [85.218.92.99]) (Authenticated sender: guillaume.yziquel@citycable.ch) by emailfrontal1.citycable.ch (Postfix) with ESMTPA id 2D86512C2FC; Thu, 12 Nov 2009 15:16:09 +0100 (CET) Message-ID: <4AFC18C3.50903@citycable.ch> Date: Thu, 12 Nov 2009 15:16:35 +0100 From: Guillaume Yziquel Reply-To: guillaume.yziquel@citycable.ch User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090707) MIME-Version: 1.0 To: Philippe Veber Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Including code from a .cm[ox] into another .cm[ox] References: <4AFBFC9E.8010802@citycable.ch> <721f7f5a0911120441h7706cd02ud9b6b993532b88f5@mail.gmail.com> <4AFC0515.5050306@citycable.ch> <721f7f5a0911120535y312f659cw6edaad7512e7cd38@mail.gmail.com> In-Reply-To: <721f7f5a0911120535y312f659cw6edaad7512e7cd38@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; guillaume:01 guillaume:01 cmo:01 findlib:01 camlp:01 -pack:01 cmo:01 toplevel:01 maxence:01 guesdon:01 submodule:01 -pack:01 overkill:01 camlp:01 overkill:01 Philippe Veber a =C3=A9crit : > You're right this is a linking issue and now the question is at which l= evel > 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 t= o > help the linker is one way to do it, but if you insist on loading a sin= gle > module then you have two other options : > - code inclusion -> m4, camlmix, camlp4 or any preprocessor (not that u= gly, > 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. You're getting my problem right. I'm working on the OCaml-R binding of=20 Maxence Guesdon. The thing is, I have a r.ml file, where all the binding work is done.=20 However, in order to launch the shared library containing the code of=20 the R interpreter, some environment variables must be set up first.=20 Therefore I have a small R script, based on Dirk Eddelbuettel's littler=20 software, that generates an .ml file, rstdenv.ml, containing the=20 environment variables that need to be set up correctly. Maybe it's trying to be a bit too pretty, but I do not like the name=20 Rstdenv for a module. I'd rather have R.Standard.env... So I'm looking for a way to include a module as a submodule, without=20 having to link it to rstdenv.cmo, which I really do not want to be=20 available from the r.cma archive. That's why I was wondering if there is a clean, camlish way, to=20 link-substitute code from one .cmo into another .cmo... The -pack option is clearly overkill, camlp4 seems overkill too, m4 is=20 ugly, do not know camlmix. There's also a package from Gerd Stolpmann,=20 xstrp4 or something like that which could be useful. But as I want to=20 minimise dependencies on extra stuff, I was wondering if there was an=20 out-of-box obscure compiling option to do so. All the best, Guillaume Yziquel. > 2009/11/12 Guillaume Yziquel >=20 >> Philippe Veber a =C3=A9crit : >> >> Hi >>> maybe you can have a look at findlib and its #require statement. For >>> instance, pxp (xml related library) depends on many cma, but everythi= ng >>> loads automagically when invoking #require : >>> >> No, no, no... this is not the issue at all. My issue is not about load= ing >> 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 >>> Hello. >>>> Imagine I have a file named a.ml containing >>>> >>>> module C =3D struct >>>> >>>>> include B >>>>> end >>>>> >>>>> and a file named b.ml containing the code >>>> let f x =3D x + 1 >>>> When I compile everything to .cmo files, I cannot load a.cmo from th= e >>>> 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 l= oad >>>> 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/