Commit 4858bc78 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-06-28 17:07:22 by afrisch] Empty log message

Original author: afrisch
Date: 2004-06-28 17:07:22+00:00
parent 25ffd4d5
let sdl_version = string_of (external "Sdl.version" [])
let [] =
print [ 'Sdl version' !sdl_version '\n' ];
external "Sdl.init" `None [ `EVERYTHING ];
let n = string_of (external "Sdlcdrom.get_num_drives" []) in
print [ 'Drives:' !n '\n' ];
let cd = external "Sdlcdrom.cd_open" 0 in
external "Sdlcdrom.cd_eject" cd
......@@ -296,4 +296,42 @@ Here is the protocol to compile a single CDuce module:
</p>
</box>
<box title="Examples" link="examples">
<section title="Getting the value of an environment variable">
<sample>
let home = external "Sys.getenv" "home";;
</sample>
</section>
<section title="Ejecting your CD with CDuce">
<p>
This example demonstrates how to use OCamlSDL library.
</p>
<sample>
external "Sdl.init" `None [ `EVERYTHING ];;
let cd = external "Sdlcdrom.cd_open" 0;;
external "Sdlcdrom.cd_eject" cd;;
</sample>
<p>
If you put these lines in a file <code>cdsdl.cd</code>, you can
compile and link it with:
</p>
<sample>
cduce --compile cdsdl.cd -I `ocamlfind query ocamlsdl`
ocamlfind ocamlc -o cdsdl -pp "cdo2ml -static" -impl cdsdl.cdo -package cduce,ocamlsdl -linkpkg
</sample>
</section>
</box>
</page>
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