From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 4581BBB84 for ; Wed, 28 Jun 2006 17:44:54 +0200 (CEST) Received: from m14s26.vip-server.net (m14s26.vip-server.net [193.138.181.188]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k5SFiqlD006809 for ; Wed, 28 Jun 2006 17:44:54 +0200 Received: from [=EIPv6:::1] (localhost [127.0.0.1]) by m14s26.vip-server.net (Postfix) with ESMTP id 795F28924A; Wed, 28 Jun 2006 17:36:08 +0200 (CEST) In-Reply-To: <200606281050.k5SAo4ee008939@nez-perce.inria.fr> References: <200606281050.k5SAo4ee008939@nez-perce.inria.fr> Mime-Version: 1.0 (Apple Message framework v752.2) X-Priority: 3 Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <86804392-80E8-4968-89CC-6ECDF6DC128A@informatik.uni-kl.de> Cc: caml-list@yquem.inria.fr Content-Transfer-Encoding: 7bit From: Jean-Marie Gaillourdet Subject: Re: [Caml-list] Retyping module to a new signature Date: Wed, 28 Jun 2006 17:45:09 +0200 To: Piotr Wieczorek X-Pgp-Agent: GPGMail 1.1.2 (Tiger) X-Mailer: Apple Mail (2.752.2) X-Miltered: at concorde with ID 44A2A3F4.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; hash:01 ocaml:01 compiler:01 bytecode:01 foo:01 byte:01 foo:01 cmo:01 mli:01 val:01 ocamlc:01 ocamlc:01 mli:01 cmo:01 binary:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, On 28.06.2006, at 12:49, Piotr Wieczorek wrote: > Hi! > I'm trying for quite a time, to make patch to Ocaml compiler which > makes possible taking a bytecompiled module and producing identical > module but conforming to a new signature. > I've used some code from bytepackager to calculate coercion and > copy bytecode from original module to target one. > It works ok. But if order of functions in target signature is > different then in source signature, calling a function may cause > not running right one, but another. > Can you tell me what may I be doing wrong, or wether what i'm > trying to accomplish is possible. > Why do you try do that in the first place? Let us assume you have a module Foo which is stored in byte code file foo.cmo, which was compiled frome the file foo.ml - -- foo.ml -- let foo x y= x + y let bar x = x - ------------ If you want to constraint Foo to a module Bar which includes only the first function you could use the following source: - -- bar.mli ---- val foo : int -> int -> int - --------------- - -- bar.ml ----- include Foo - --------------- I compiled everything with: $ ocamlc foo.ml $ ocamlc bar.mli $ ocamlc foo.cmo bar.ml The first step is in your step eventually not necessary, because you wanted to start with a binary module. Hope this helps. Best regards, Jean-Marie -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Darwin) iD8DBQFEoqQJNIUNP/I5YOgRAg5EAJ9TEP3e+8MlNxqx1jhBV3uAicjuHQCglSLw JBc3ol9wBQ0ivgcrlbw3K0I= =wQlS -----END PGP SIGNATURE-----