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
Ocamlbuild for project with C portion
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-09-22 (14:44)
From: Dario Teixeira <darioteixeira@y...>
Subject: Re: [Caml-list] Ocamlbuild for project with C portion

> The key is to create a file with the extension ".clib" that contains
> the list of .o files that should be compiled from your C stubs. Ocamlbuild
> will then build these into a libary (foo.clib will result in foo.a).  You
> then add rules in myocamlbuild.ml that define tags for depending on and
> linking with that library, and add these to your _tags file.

Thanks for your reply.  In the end I managed to solve the problem, though
not using clib (which seems tangential to this problem).  All that was
required was the following myocamlbuild.ml:

open Ocamlbuild_plugin
open Command

let _ = dispatch begin function
        | After_rules ->
                flag ["ocaml"; "byte"; "link"] (S[A"-custom"]);
                dep ["ocaml"; "link"] ["foobar.o"]
        | _ -> ()

Though it still strikes me as odd that Ocamlbuild's manual won't cover
such basic examples...

Best regards,
Dario Teixeira