Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Eric Cooper <ecc@c...>
Subject: Re: [Caml-list] Ocamlbuild for project with C portion
On Mon, Sep 21, 2009 at 09:05:42AM -0700, Dario Teixeira wrote:
> The Ocamlbuild manual begins by stating that the tool has builtin support
> for projects with C stubs, but unfortunately is subsequently mute on the
> subject.  So, I have a foobar.ml module that declares an external function
> "stuff" which is defined in foobar_lowlevel.c.  What is the Ocamlbuild
> tagging wizardry that allows this programme to compile?

There is an example in
  http://brion.inria.fr/gallium/index.php/Ocamlbuild_example_with_C_stubs 

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.

-- 
Eric Cooper             e c c @ c m u . e d u