Commit cbd82743 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-02-19 02:43:10 by beppe] Added INSTALL and README

Original author: beppe
Date: 2004-02-19 02:43:10+00:00
parent 883dbfa1
#
# cdo2cmo extension by Julien Demouth
#
If you install all your sources in /usr/local/src/ then
1) Go in the directory of ocaml sources
cd /usr/local/src/ocaml-3.07
2) apply the patch
patch -p1 < /<source_path>/cduce/cdo2cmo/ocaml_cdo2cmo_patch
3) Optional (if your version of Ocaml is 3.07-pl2 you do not need it)
make and install ocaml as usual and recompile at least all the
ocaml libraries used by cduce
4) Create the library OCaml_all and install it, this is done by running
in the (patched) ocaml source the following command
make install_all_libs
5) Go in the cduce source directory and create cDuce_all
cd /usr/local/src/cduce
make cDuce_all
6) Go in the cdo2cmo dir create a new lilb directory and copy
there the cDuce_all.* files and make all
cd cdo2cmo
mkdir lib
cp ../cDuce_all.* lib
make
Imagine that you want to call the following CDuce function in an ocaml
program:
type ML_int = -1073741824 -- 1073741823
type Printer = ML_int -> []
let f ( Printer -> [ ML_int * ] -> [] ) g ->
fun ( list :[ Int * ]):[] =
transform list with
x & ML_int -> g x
| _ -> raise "Int overflow"
1) Save this in a file test.cd.
2) Write the ocaml interface file test.mli:
val f : ( int -> unit ) -> int list -> unit
3) Compile test.cd to obtain test.cdo
cduce --compile test.cd
4) Generate test.cmo from test.cdo
cdo2cmo test.cmi test.cdo
5) Now you can call f from a ocaml program say main.ml
let () = Test.f (Format.eprintf "print = %d@.") [1 ; 2 ; 3 ]
that can be compiled as usual
......@@ -17,9 +17,10 @@
toplevel/toplevellib.cma: $(TOPLIB)
$(CAMLC) -a -o $@ $(TOPLIB)
+
+ oCaml_all.cma: $(ALLLIB)
+ install_all_libs: $(ALLLIB)
+ $(CAMLC) -pack -o oCaml_all.cmo $(ALLLIB)
+ $(CAMLC) -a -o oCaml_all.cma oCaml_all.cmo
+ cp oCaml_all.cma $(LIBDIR)
partialclean::
rm -f ocaml toplevel/toplevellib.cma
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment