Version française
Home     About     Download     Resources     Contact us    
Browse thread
simple example of using ocamlbuild with C
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Matthieu Dubuget <matthieu.dubuget@g...>
Subject: Re: [Caml-list] simple example of using ocamlbuild with C
---- myocamlbuild.ml ------

open Ocamlopen Ocamlbuild_plugin
open Command
;;
dispatch begin function
 | After_rules ->
     flag ["link"; "ocaml"; "byte"] (A"-custom");
     dep  ["link"; "ocaml"; "use_my_math"] ["avg.o"];
 | _ -> ()
end

---- _tags ----- (do not forget the endline before end of file)
<run.{native,byte}>: use_my_math

++++++++++++++++

Works for me.

Salutations

P.S.

 I had to modify the beginning of

---- avg.c ---
#include <stdio.h >
#include <stdlib.h>
#include <caml/mlvalues.h>
#include <caml/memory.h>

into

---- avg.c ---
#include <caml/mlvalues.h>
#include <caml/memory.h>
#include <caml/alloc.h>