English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
caml_oldify_local_roots crashes
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-12-26 (04:35)
From: Jon Harrop <jdh30@h...>
Subject: Re: [Caml-list] caml_oldify_local_roots crashes

On Sat, 25 Dec 2004, haiku.issa wrote:
> I am currently developping a small piece of software that uses
> both OCaml and C (for openGL). The main loop is in C and I use
> callback to call a Caml function that processes the key that
> was pressed and returns the new state of a matrix.

Do you have to use C at all? Have you looked at lablGL?

I strongly recommend that you avoid interfacing to C whenever possible...

> Everything worked fine until I added a subfunction that simply
> merges two int lists.

I am no expert on this but I believe this implies that your interfacing 
between C and OCaml was already broken. Almost certainly something to do 
with the GC. There are rules that you must adhere to when writing the 
interface code, of course, and human errors are a great cause of bugs 
here. I'd also strongly recommend that you try to write the simplest 
possible first working version and optimise it later only if necessary. 
Unfortunately I'm too drunk and full of turkey to help with any code right 


PS: If you program starts at "main" in C code then I assume you've 
initialised the OCaml GC before calling any OCaml code?