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.2 required=5.0 tests=AWL 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 AE14DBB84 for ; Sun, 1 Jun 2008 13:00:23 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApQBAA8eQkjAXQImiGdsb2JhbACSCwEBAQ8glGeEWg X-IronPort-AV: E=Sophos;i="4.27,573,1204498800"; d="scan'208";a="13331055" Received: from discorde.inria.fr ([192.93.2.38]) by mail3-smtp-sop.national.inria.fr with ESMTP; 01 Jun 2008 13:00:23 +0200 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m51B0MPK028973 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sun, 1 Jun 2008 13:00:23 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicCAJcdQkjRVYa4c2dsb2JhbACSCwEMAwQECQ8FlGSEWg X-IronPort-AV: E=Sophos;i="4.27,573,1204498800"; d="scan'208";a="11401407" Received: from mu-out-0910.google.com ([209.85.134.184]) by mail2-smtp-roc.national.inria.fr with ESMTP; 01 Jun 2008 13:00:21 +0200 Received: by mu-out-0910.google.com with SMTP id i10so681830mue.7 for ; Sun, 01 Jun 2008 04:00:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to:user-agent:mime-version:to:subject:x-enigmail-version:content-type:content-transfer-encoding; bh=PDhf211dOcEe6Ak5Wi7Hu591tXZPMsV3FKBvZsMsLiE=; b=DTTqWDxsuQuDEGh4F/gRF0PY14r/vkz6cQ1L2b1kTJ7KJ0n0tCXJOakAl7KPu7vUTaEx2COqyoXkUitlvEeB0kaAXmy6wS2d4SAIs6enBY3hv69faD3EOEjYwRWglPsoX55QDjt0ab8ZtGAMeMZwTNK9DL871rIBWK1B75r701c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:user-agent:mime-version:to:subject:x-enigmail-version:content-type:content-transfer-encoding; b=trxOld1VwjvMlmXRLnet4jZlAbwMIs6T+BQaIrjDVaALa/QofrcI6bCS7hLuimBhScVqQ6IybHz+HxBo/t2smpsBrG0QlQWxOHwWFjfwN8xfnFRrymnnqjTm2gOnNgbEhu/7iF6CbrsAR0wYv6qrAEX2pGeRSbjSRVqub0G0vz4= Received: by 10.103.141.8 with SMTP id t8mr4852654mun.101.1212318019994; Sun, 01 Jun 2008 04:00:19 -0700 (PDT) Received: from ?192.168.1.10? ( [77.197.50.201]) by mx.google.com with ESMTPS id j10sm4390008mue.6.2008.06.01.04.00.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 01 Jun 2008 04:00:15 -0700 (PDT) Message-ID: <48428185.6010503@gmail.com> Date: Sun, 01 Jun 2008 13:01:25 +0200 From: Matthieu Dubuget Reply-To: matthieu.dubuget@gmail.com User-Agent: Thunderbird 2.0.0.14 (X11/20080505) MIME-Version: 1.0 To: caml-list@inria.fr Subject: Ocamlbuild: could help embedding Ocaml code into shared object? X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 48428146.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; matthieu:01 dubuget:01 matthieu:01 dubuget:01 ocaml:01 cmx:01 nativecode:01 cmo:01 byte:01 byte:01 bytecode:01 -output-obj:01 ocaml:01 dependencies:01 runtime:01 I often deliver my work as shared objects (DLL, in fact, because I'm stuck with Windows at work). I would like to have ocamlbuild take care of this, but I don't know exactly how to do it? The idea would be to split the work in two separate rules. The first rule generates a shared object from the Objective Caml code: rule "mloo & cmx* -> native.oo.o" ~dep:"%.mloo" ~prod:"%.native.oo.o" action_for_nativecode rule "mloo & cmo* -> byte.oo.o" ~dep:"%.mloo" ~prod:"%.byte.oo.o" action_for_bytecode The actions should return commands with A "-output-obj". But I do not know how to write them. It would need a mechanism similar to the one used for mlpack. For example, one .mloo file listing the ocaml files to link into the output object. Dynamic dependencies are to be generated from the content of the .mloo file. Unfortunately, I have no idea how to write that? The second rule would generate a shared object from the .o files. Maybe the current clib is enough? I have to add a flag to link the runtime engine by adding -lasmrun -lm -ldl (-lm and -ldl being deduced from the output of ocaml* -config). Am I looking in the right direction? Thanks in advance for your help Matt