From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA27795; Thu, 12 Jul 2001 09:45:06 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA27791 for ; Thu, 12 Jul 2001 09:45:05 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f6C7j2n21177; Thu, 12 Jul 2001 09:45:02 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA27786; Thu, 12 Jul 2001 09:45:02 +0200 (MET DST) Date: Thu, 12 Jul 2001 09:45:02 +0200 From: Xavier Leroy To: Dekai Li Cc: caml-list@inria.fr Subject: Re: [Caml-list] How to add primitives to the standard ones? Message-ID: <20010712094502.A27670@pauillac.inria.fr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from dekai@dsl.cis.upenn.edu on Wed, Jul 11, 2001 at 12:29:07PM -0400 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > I tried to add a primitive to the standard primitives as follows. > > 1. I put my foo.c file in byterun/ and put the /* ML */ at the end > of the primitives. > > 2. In byterun/Makefile, I added foo.o to macro OBJS and foo.c to PRIMS. > > 3. In stdlib/pervasives.ml, I added the declaration for my primitive and > in stdlib/pervasives.mli, I exported the primitives. This is about right, but you need to be very careful about bootstrapping issues. What should work is: - start with pristine OCaml sources - do "make world" - perform your changes - do "make all" (NOT "make world") - do "make bootstrap" to make sure everything is OK. This said, there is absolutely no need to change the system to get access to new C primitives: the -custom mode or the -make-runtime and -use-runtime options to ocamlc provide much simpler ways of doing it. Indeed, I would advise against adding your stuff to Pervasives and the standard runtime system: it's going to be much harder for you to track OCaml changes and for others to use your code. - Xavier Leroy ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr