Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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 
now...

Cheers,
Jon.

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