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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id EBD23BB84 for ; Thu, 5 Jun 2008 21:18:29 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AggBAAPZR0jRVaKweGdsb2JhbACSAwEMAwQGBxEDmEyGIA X-IronPort-AV: E=Sophos;i="4.27,597,1204498800"; d="scan'208";a="11626064" Received: from concorde.inria.fr ([192.93.2.39]) by mail2-smtp-roc.national.inria.fr with ESMTP; 05 Jun 2008 21:18:29 +0200 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m55JITqm019200 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 5 Jun 2008 21:18:29 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AggBAAPZR0jRVaKweGdsb2JhbACSAwEMAwQGBxEDmEyGIA X-IronPort-AV: E=Sophos;i="4.27,597,1204498800"; d="scan'208";a="11626063" Received: from el-out-1112.google.com ([209.85.162.176]) by mail2-smtp-roc.national.inria.fr with ESMTP; 05 Jun 2008 21:18:28 +0200 Received: by el-out-1112.google.com with SMTP id j27so268979elf.9 for ; Thu, 05 Jun 2008 12:18:27 -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:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=LKmgnwLoUYZOAhHjcMA8TpEwaDKUj2rQvs7MdWMmcYI=; b=hrGaVHA4b+aDRbgBKrTsWbbODPb4vQKgHvF9j2JPUUmaJDf932ajZn+zRORPvxxhc5 ILanzVW3z/UK7XbpXQF3g1vf9OoS5AZ5xJqV7KDyP/+gUcFhoDz12s3Efy5Dm5T/5P0G B3eHOFLrn9cuWhL5OvJMayKEc557jgXQGug/s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=eNRQKn64swTnXXLV1ZYqaJkeEWMbUBJQcgxIWaFa5A7N5uzY7NAGToxmCqWV0AZrBy nl7pyCB0RIu3oLH3CC3pcl8bOXRI9+OeEqTDuhkxUkHYHXWF6LEbIUAHZbfxO5fCJ0x4 BXJ2aquhew5X0YQjEu36Ti6x1WtIrKYR8FMA0= Received: by 10.103.247.14 with SMTP id z14mr1006084mur.39.1212693506582; Thu, 05 Jun 2008 12:18:26 -0700 (PDT) Received: from ?192.168.1.10? ( [77.200.39.85]) by mx.google.com with ESMTPS id b9sm5555021mug.13.2008.06.05.12.18.24 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 05 Jun 2008 12:18:25 -0700 (PDT) Message-ID: <48483C66.8090206@gmail.com> Date: Thu, 05 Jun 2008 21:20:06 +0200 From: Matthieu Dubuget Reply-To: matthieu.dubuget@gmail.com User-Agent: Thunderbird 2.0.0.14 (X11/20080505) MIME-Version: 1.0 To: Romain Bardou Cc: caml-list@inria.fr Subject: Re: [Caml-list] Ocamlbuild: could help embedding Ocaml code into shared object? References: <48428185.6010503@gmail.com> <4847A7E6.9020506@lri.fr> In-Reply-To: <4847A7E6.9020506@lri.fr> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Miltered: at concorde with ID 48483C05.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 Romain Bardou a écrit : > Matthieu Dubuget a écrit : >> 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 > > I know nothing about DLLs and OCaml but if I understand correctly, you > need the following. > > 1) How to parse a file similar to a .mllib file in a plug-in. There is > an example in the Ocamlfind plug-in on the wiki: > > http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild#Source > > > You want to look at the find_packages function. > > 2) How to generate dynamic dependencies. This is done by calling the > second argument of the function you give to the rule function. This is > also explained in the wiki: > > http://brion.inria.fr/gallium/index.php/Making_plugins#Dynamic_dependencies > > > I hope it helps. > Thanks for the links Romain. I will have a look. Matt