caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Dekai Li <dekai@dsl.cis.upenn.edu>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] How to add primitives to the standard ones?
Date: Thu, 12 Jul 2001 09:45:02 +0200	[thread overview]
Message-ID: <20010712094502.A27670@pauillac.inria.fr> (raw)
In-Reply-To: <Pine.SOL.4.21.0107111221250.11346-100000@codex.cis.upenn.edu>; from dekai@dsl.cis.upenn.edu on Wed, Jul 11, 2001 at 12:29:07PM -0400

> 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


      reply	other threads:[~2001-07-12  7:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-11 16:29 Dekai Li
2001-07-12  7:45 ` Xavier Leroy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010712094502.A27670@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=dekai@dsl.cis.upenn.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).