Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] native-code and byte-code compiler differences
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Sylvain LE GALL <sylvain.le-gall@p...>
Subject: Re: [Caml-list] native-code and byte-code compiler differences
On Fri, Mar 29, 2002 at 04:00:41PM -0500, Attila Kondacs wrote:
> the following is a code segment that opens a window and if 'q' is
> pressed  on the keyboard it closes it. It works with the byte code
> compiler fine but does not react to pressed keys when compiled with the
> native code compiler (using ocaml 3.04 for debian - from the unstable
> distribution).
> According to the ocaml manual this may happen if there is devision by 0
> caught as an exception, or stack overflow, or if signal handling is
> involved. The first two cases are out of question here, and as far as I
> know reading mouse and keyboard events do not involve signals. So what's
> wrong here? and how can it be put right?

Your code is good and work perfectly but as you say : 
 According to the ocaml manual ... 
   This library is implemented under the X11 windows system. Programs
   that use the graphics library must be linked as follows:

   ocamlc other options graphics.cma other files

   For interactive use of the graphics library, do:

   ocamlmktop -o mytop graphics.cma

	   or (if dynamic linking of C libraries is supported on your
	   platform), start ocaml and type #load "graphics.cma";;.

In other word no command specified for ocamlopt. So it seems to not
works properly with native compiler.

As far as my exprience, graphics is a pretty good library but as many
restriction. If you want other fault ( and it is with the bytecode ).
Try open_graphic... Unix.socket... For me the code crash
and give me an exception explaining an unknow error raised ( but it
works with no graphics opened ).

If i were you i try labltk or lablgtk... ( longer to code but more close
to system abstraction )

Sylvain LE GALL
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: