caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Daniel Weil <danweil68@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Build number and date in OCaml?
Date: Fri, 12 Apr 2013 16:38:45 +0200	[thread overview]
Message-ID: <CA+kyP8DhTtWEq=Jc7+jt8Wf01XshUML7vXEa4mOokHX2MLAcCA@mail.gmail.com> (raw)
In-Reply-To: <5166B3F9.9040105@lexifi.com>

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

If you like ocambuild, an alternative is to add a small rule in your
ocamlbuild plugin.
The ocamlbuild wiki gives an example of ocamlbuild plugin that create a "
version.ml" file in the _build directory at each build. You can then link
your code with this version.ml file.

http://brion.inria.fr/gallium/index.php/Automatic_Version_Generation

Daniel




2013/4/11 Alain Frisch <alain.frisch@lexifi.com>

> On 04/09/2013 01:38 PM, Étienne André wrote:
>
>> I quite stupidly used the Unix.gettimeofday() function before realizing
>> that it is of course executed at runtime.
>>
>
> As others suggested, you can tell your build system to generate an ad hoc
> file containing the compile-time information.  Another approach is to use a
> preprocessor to inject such compile-time information into the source code
> "on the fly" during its compilation.  This can be done with a dedicated
> Camlp4 syntax extension or a -ppx preprocessor (available in trunk only,
> with syntactic extension points being designed in the extension_points
> branch of the OCaml SVN).
>
> As an illustration of the -ppx approach, I've created a tiny preprocessor
> which uses the OCaml toplevel to evaluate expressions and inserts the
> result as constants in the compiled code.
>
> The source code for this -ppx preprocessor can be found here:
>
> http://caml.inria.fr/cgi-bin/**viewvc.cgi/ocaml/branches/**
> extension_points/experimental/**frisch/eval.ml?&view=markup<http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/branches/extension_points/experimental/frisch/eval.ml?&view=markup>
>
> and here is an example of what you can write with it:
>
> http://caml.inria.fr/cgi-bin/**viewvc.cgi/ocaml/branches/**
> extension_points/experimental/**frisch/test_eval.ml?&view=**markup<http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/branches/extension_points/experimental/frisch/test_eval.ml?&view=markup>
>
> (To play with it, you need to checkout the extension_points branch and
> after compiling it: cd experimental/frisch && make eval)
>
> -- Alain
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/**arc/caml-list<https://sympa.inria.fr/sympa/arc/caml-list>
> Beginner's list: http://groups.yahoo.com/group/**ocaml_beginners<http://groups.yahoo.com/group/ocaml_beginners>
> Bug reports: http://caml.inria.fr/bin/caml-**bugs<http://caml.inria.fr/bin/caml-bugs>
>

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

      reply	other threads:[~2013-04-12 14:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-09 11:38 Étienne André
2013-04-09 12:18 ` Jeremie Dimino
2013-04-10  8:49 ` Julien Signoles
2013-04-10  9:08   ` David Allsopp
2013-04-11 13:00 ` Alain Frisch
2013-04-12 14:38   ` Daniel Weil [this message]

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='CA+kyP8DhTtWEq=Jc7+jt8Wf01XshUML7vXEa4mOokHX2MLAcCA@mail.gmail.com' \
    --to=danweil68@gmail.com \
    --cc=caml-list@inria.fr \
    /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).