Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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

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