* [Caml-list] How to add primitives to the standard ones?
@ 2001-07-11 16:29 Dekai Li
2001-07-12 7:45 ` Xavier Leroy
0 siblings, 1 reply; 2+ messages in thread
From: Dekai Li @ 2001-07-11 16:29 UTC (permalink / raw)
To: caml-list
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.
Yet it kept telling me that it can't find the external functions.
What else should I do?
Thanks.
dekai
-------------------
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] How to add primitives to the standard ones?
2001-07-11 16:29 [Caml-list] How to add primitives to the standard ones? Dekai Li
@ 2001-07-12 7:45 ` Xavier Leroy
0 siblings, 0 replies; 2+ messages in thread
From: Xavier Leroy @ 2001-07-12 7:45 UTC (permalink / raw)
To: Dekai Li; +Cc: caml-list
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-07-12 7:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-11 16:29 [Caml-list] How to add primitives to the standard ones? Dekai Li
2001-07-12 7:45 ` Xavier Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox