caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: Dario Teixeira <darioteixeira@yahoo.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Telling Ocamlbuild to link seemingly unreferenced modules
Date: Fri, 6 May 2011 17:38:02 +0200	[thread overview]
Message-ID: <BANLkTinYw-aRh9MvZ36tTB0F_oD5MZfsBA@mail.gmail.com> (raw)
In-Reply-To: <398504.86739.qm@web111515.mail.gq1.yahoo.com>

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

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 <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.  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
>
>

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

  reply	other threads:[~2011-05-06 15:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-06 14:34 Dario Teixeira
2011-05-06 15:38 ` Gabriel Scherer [this message]
2011-05-06 17:09 Dario Teixeira
2011-05-06 19:34 Dario Teixeira

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=BANLkTinYw-aRh9MvZ36tTB0F_oD5MZfsBA@mail.gmail.com \
    --to=gabriel.scherer@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=darioteixeira@yahoo.com \
    /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).