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 33898BB83 for ; Mon, 14 Aug 2006 17:41:38 +0200 (CEST) Received: from smtp-msa-out07.orange.fr (smtp7.orange.fr [193.252.22.24]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k7EFfX4U022391 for ; Mon, 14 Aug 2006 17:41:38 +0200 Received: from morgana (ARennes-257-1-49-109.w81-53.abo.wanadoo.fr [81.53.128.109]) by mwinf0701.orange.fr (SMTP Server) with ESMTP id 7AEF97000082; Mon, 14 Aug 2006 17:41:31 +0200 (CEST) X-ME-UUID: 20060814154131503.7AEF97000082@mwinf0701.orange.fr Received: from david by morgana with local (Exim 4.50) id 1GCeaV-0002XP-P7; Mon, 14 Aug 2006 17:42:47 +0200 To: Tom Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Dynamic loading of bytecode References: From: David MENTRE Organization: none Date: Mon, 14 Aug 2006 17:42:47 +0200 In-Reply-To: (tom.primozic@gmail.com's message of "Mon, 14 Aug 2006 17:21:25 +0200") Message-ID: <87oduniars.fsf@linux-france.org> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Miltered: at concorde with ID 44E099AD.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; bytecode:01 bytecode:01 ocamlc:01 ocamlc:01 toploop:01 ocaml:01 toplevel:01 ocaml:01 cmo:01 cmo:01 3.08.3:01 toplevel:01 3.08.3:01 val:01 gpg: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 Hello, Tom writes: > Say I have files a.ml: > > let f x = x - 1 > > and b.ml: > > let g x y = x + f y - f x let g x y = x + A.f y - A.f x > > and I compile them into bytecode > > ocamlc -c a.ml > ocamlc -c b.ml > > and then I want to be able to load them into the toploop so that I could > access both modules A and B: > > # let simplify x = B.g x - A.f x > > > How do I do that? * In command line given to ocaml toplevel: $ ocaml a.cmo b.cmo Objective Caml version 3.08.3 # B.g 1 2;; * Inside the toplevel, you need to #load each bytecode file: $ ocaml Objective Caml version 3.08.3 # #load "a.cmo";; # #load "b.cmo";; # let simplify x = B.g x x - A.f x;; val simplify : int -> int = TFM: http://caml.inria.fr/pub/docs/manual-ocaml/manual023.html Best wishes, d. PS: This kind of question might better go to caml-beginners@ mailing list. -- GPG/PGP key: A3AD7A2A David MENTRE 5996 CC46 4612 9CA4 3562 D7AC 6C67 9E96 A3AD 7A2A