From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 7A4D0BB91 for ; Sun, 26 Dec 2004 05:35:56 +0100 (CET) Received: from ppsw-8.csi.cam.ac.uk (ppsw-8.csi.cam.ac.uk [131.111.8.138]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iBQ4Zu91006232 for ; Sun, 26 Dec 2004 05:35:56 +0100 Received: from hermes-1.csi.cam.ac.uk ([131.111.8.51]:41473) by ppsw-8.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.158]:25) with esmtpa (EXTERNAL:jdh30) id 1CiQ8H-00022b-Qi (Exim 4.44) for caml-list@yquem.inria.fr (return-path ); Sun, 26 Dec 2004 04:35:53 +0000 Received: from jdh30 (helo=localhost) by hermes-1.csi.cam.ac.uk (hermes.cam.ac.uk) with local-esmtp id 1CiQ8H-0006zb-75 (Exim 4.43) for caml-list@yquem.inria.fr (return-path ); Sun, 26 Dec 2004 04:35:53 +0000 Date: Sun, 26 Dec 2004 04:35:53 +0000 (GMT) From: Jon Harrop X-X-Sender: jdh30@hermes-1.csi.cam.ac.uk Cc: caml-list Subject: Re: [Caml-list] caml_oldify_local_roots crashes In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ X-Cam-AntiVirus: No virus found X-Cam-SpamDetails: Not scanned X-Miltered: at nez-perce with ID 41CE3FAC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 oldify:01 wrote:01 developping:01 ocaml:01 lablgl:01 interfacing:01 interfacing:01 ocaml:01 optimise:01 cheers:01 ...:98 ...:98 int:01 opengl:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.5 required=5.0 tests=FROM_ENDS_IN_NUMS autolearn=disabled version=3.0.0 X-Spam-Level: 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?