English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
documentation for building C++ libraries with ocamlbuild
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-03-25 (10:17)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] documentation for building C++ libraries with ocamlbuild
Sorry, my first mail is unfinished...

On 3/24/07, Christian Sternagel <christian.sternagel@uibk.ac.at> wrote:
> Is there some documentation or at least a tutorial for how to setup ocamlbuild in order to build a lib<name>.a file from a bunch of *.c, *.C, and *.h files?


$ cat libfoo.clib

$ ocamlbuild libfoo.a

> And after having done that, how to tell ocamlbuild that some ocmal-program which is build depends on lib<name>.a.

$ cat _tags
<myocamprog.{byte,native}: use_foo

$ cat myocamlbuild.ml
open Ocamlbuild_plugin;;
open Command;;
dispatch begin function
| After_rules ->
    flag ["ocaml"; "link"; "use_foo"]
            (S[A"-cc"; A"g++"; A"-ccopt"; A"-Lfoo"; A"-custom";
A"-cclib"; A"-Ifoo"]);
    dep ["ocaml"; "link"; "use_foo") ["libfoo.a"]

Some `flag' declaration might be useful in order to tweak the C/C++ compilation.

Nicolas Pouillard