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 AB852BC48 for ; Tue, 19 Apr 2005 11:37:19 +0200 (CEST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j3J9bJA0021557 for ; Tue, 19 Apr 2005 11:37:19 +0200 Received: from localhost (akasha.ijm.jussieu.fr [134.157.173.57]) by shiva.jussieu.fr (8.12.11/jtpda-5.4) with ESMTP id j3J9bHq1045626 ; Tue, 19 Apr 2005 11:37:17 +0200 (CEST) X-Ids: 165 Date: Tue, 19 Apr 2005 11:37:16 +0200 (CEST) Message-Id: <20050419.113716.74731383.andrieu@ijm.jussieu.fr> To: jonathan.roewen@gmail.com Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Initialising caml values from C From: Olivier Andrieu In-Reply-To: References: X-Mailer: Mew version 4.1 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.7.2 (shiva.jussieu.fr [134.157.0.165]); Tue, 19 Apr 2005 11:37:18 +0200 (CEST) X-Antivirus: scanned by sophie at shiva.jussieu.fr X-Miltered: at nez-perce with ID 4264D14F.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at shiva.jussieu.fr with ID 4264D14D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 andrieu:01 andrieu:01 ijm:01 initialise:01 ocaml:01 runtime:01 buffer:01 bigarray:01 elt:01 bigarray:01 initialiser:01 ...:98 jussieu:01 functions:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: Jonathan Roewen [Tue, 19 Apr 2005]: > I'm building an ocaml-native program (actually an OS). Anyways, I > initialise the ocaml runtime from C, but the problem I have is that I > want a couple of caml values to be initialised by calling into C-land. > > Something like: (lfb is a linear frame buffer) > > external get_lfb: unit -> (int32, Bigarray.int32_elt, > Bigarray.c_layout) Bigarray.Array2.t = "get_lfb" > > (* the part that doesn't seem to work *) > > (* create a cairo instance for drawing into the LFB *) > let cairo = Cairo.create () > (* gets the LFB, makes it into a cairo image, then sets it as surface > for cairo to draw into *) > let _ = Cairo.set_target_image cairo (of_bigarr_32 true (get_lfb > ())) > > If I instead call some initialiser functions to set up the cairo > instances, it seems to be okay... but it'd make life a lot easier > if the above would work correctly. It'd especially help with other > parts of the code that use the above (and other functions/values). I don't quite understand your problem. Is it that the code (with Cairo) isn't working ? (and if yes, what exactly isn't working ?) Or you want help on how to write the get_lfb function ? -- Olivier