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-21 (17:48)
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 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 

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.

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