From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 1BF4EBBAF for ; Mon, 21 Sep 2009 19:48:04 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtACAC5Zt0qAAtnFmWdsb2JhbACBU5khAQEBAQEICwoHE6kJhVWISoQbBQ X-IronPort-AV: E=Sophos;i="4.44,425,1249250400"; d="scan'208";a="34702328" Received: from smtp02.srv.cs.cmu.edu ([128.2.217.197]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 21 Sep 2009 19:48:03 +0200 Received: from stratocaster.home (pool-96-235-26-179.pitbpa.fios.verizon.net [96.235.26.179]) (authenticated bits=0) by smtp02.srv.cs.cmu.edu (8.13.6/8.13.6) with ESMTP id n8LHlxxo010793 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Mon, 21 Sep 2009 13:48:00 -0400 (EDT) Received: from ecc by stratocaster.home with local (Exim 4.69) (envelope-from ) id 1MpmzW-0001EZ-Mt for caml-list@yquem.inria.fr; Mon, 21 Sep 2009 13:47:58 -0400 Date: Mon, 21 Sep 2009 13:47:58 -0400 From: Eric Cooper To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Ocamlbuild for project with C portion Message-ID: <20090921174758.GE2012@localhost> Mail-Followup-To: caml-list@yquem.inria.fr References: <177439.58068.qm@web111515.mail.gq1.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <177439.58068.qm@web111515.mail.gq1.yahoo.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-Scanned-By: mimedefang-cmuscs on 128.2.217.197 X-Spam: no; 0.00; stubs:01 foobar:01 foobar:01 stubs:01 foo:01 foo:01 2009:98 wrote:01 compile:01 caml-list:01 define:02 defined:02 linking:02 external:03 module:03 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