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
Initialising caml values from C
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-04-19 (09:37)
From: Olivier Andrieu <andrieu@i...>
Subject: Re: [Caml-list] Initialising caml values from C
 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 ?