From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p46FdO7B016505 for ; Fri, 6 May 2011 17:39:24 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApECAPEVxE3RVdU2kGdsb2JhbACYLzKGJgGHPAgUAQEBAQkJDQcUBCGIcZ5ljBiCLoUINIheAQEDBoYDBIIojTCIOoIuO4Mz X-IronPort-AV: E=Sophos;i="4.64,326,1301868000"; d="scan'208";a="107659275" Received: from mail-yw0-f54.google.com ([209.85.213.54]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 06 May 2011 17:39:12 +0200 Received: by ywf7 with SMTP id 7so1968559ywf.27 for ; Fri, 06 May 2011 08:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=7ocJfQ9bFF2vWbafed/CdHra796AFZh3HmWyikEK3xc=; b=OqGPxknAuEaqAQS6KMDZ1PRHCHeA++6jQvpT4aW3jkACd+87/MJ9n/XuC7ky49hz06 QY6ZXzFB2koAjMhiYnzkjn3jfp6tylSZGAz+FsmhVZe5hZ/jwUOqns50+oInW4FZivZ5 tYn72068QdRPD4vednpVZH+XofY/PjOEgyj1s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=TbSTUvApzgYKXYHUZ/zqTlF3fULWawzGBl0tkFcP6EMmPILWpsehpZ4Peyxh96yUvL 2d11pzWdC7+LCng5wshLdNgHXVjdmZVXBRIsdbWDr96kzXESTyYDPbUOkqz8jwxePvRd BCkr4qUli093XIF88QRtLwJMc0iKdeZxiauL8= Received: by 10.52.109.228 with SMTP id hv4mr628508vdb.42.1304696302040; Fri, 06 May 2011 08:38:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.114.5 with HTTP; Fri, 6 May 2011 08:38:02 -0700 (PDT) In-Reply-To: <398504.86739.qm@web111515.mail.gq1.yahoo.com> References: <398504.86739.qm@web111515.mail.gq1.yahoo.com> From: Gabriel Scherer Date: Fri, 6 May 2011 17:38:02 +0200 Message-ID: To: Dario Teixeira Cc: caml-list@inria.fr Content-Type: multipart/alternative; boundary=bcaec54860889f7a3c04a29d473b Subject: Re: [Caml-list] Telling Ocamlbuild to link seemingly unreferenced modules --bcaec54860889f7a3c04a29d473b Content-Type: text/plain; charset=ISO-8859-1 Hello, I'm not exactly sure this is a complete answer to your problem (I'm not familiar with plugin linking and all that), but here is a small test: a.ml: > let () = print_endline "I'm 'a'!" > b.ml: > let () = print_endline "I'm 'b'!" > myocamlbuild.ml: > open Ocamlbuild_plugin > > let _ = dispatch begin function > | After_rules -> > dep ["use_b"] ["b.cmo"] > | _ -> () > end > I i run "ocamlbuild a.byte", then executing a.byte will only print "I'm 'a'!". If I add the following _tags: "a.byte": use_b Then a.byte will print both "I'm 'a'!" and "I'm 'b'!". I don't know the exact semantics of this 'dispatch' function (After_rules, etc.), I just imitated it from an other project doing a similar thing. I suppose you could find more detailed answers in the ocamlbuild documentation. Hope it helps. On Fri, May 6, 2011 at 4:34 PM, Dario Teixeira wrote: > Hi, > > I have a couple of plugin modules (say, "Foo.ml" and "Bar.ml") which become > known to the main programme solely because they register themselves upon > initialisation. However, because there is no implicit dependency between > the main programme and these plugins, when compiling with Ocamlbuild they > are not linked in. So what's the cleanest way of telling Ocamlbuild that > these plugins should also be compiled and linked together with the main > programme? > > Thanks in advance! > Dario > > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > > --bcaec54860889f7a3c04a29d473b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello,

I'm not exactly sure this is a complete answer to your pr= oblem (I'm not familiar with plugin linking and all that), but here is = a small test:

a.ml:
let () =3D print_endline "I'm 'a'!"
<= br>b.ml:
let () =3D print_endline "I'm 'b'!"
<= br>myocamlbuild.ml:
open Ocamlbuild_plugin

let _ =3D dispatch begin function
=A0 | Af= ter_rules ->
=A0=A0=A0 dep ["use_b"] ["b.cmo"]=A0 | _ -> ()
end

I i run "ocamlbuild a.byt= e", then executing a.byte will only print "I'm 'a'!&q= uot;.

If I add the following _tags:
=A0 "a.byte": use_b

T= hen a.byte will print both "I'm 'a'!" and "I'= ;m 'b'!".

I don't know the exact semantics of this = 'dispatch' function (After_rules, etc.), I just imitated it from an= other project doing a similar thing. I suppose you could find more detaile= d answers in the ocamlbuild documentation.

Hope it helps.

On Fri, May 6, 2011 at= 4:34 PM, Dario Teixeira <darioteixeira@yahoo.com> wrote:
Hi,

I have a couple of plugin modules (say, "Foo.ml" and "Bar.ml= ") which become
known to the main programme solely because they register themselves upon
initialisation. =A0However, because there is no implicit dependency between=
the main programme and these plugins, when compiling with Ocamlbuild they are not linked in. =A0So what's the cleanest way of telling Ocamlbuild = that
these plugins should also be compiled and linked together with the main
programme?

Thanks in advance!
Dario



--
Caml-list mailing list. =A0Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


--bcaec54860889f7a3c04a29d473b--