Re: Need help: O'Caml C Interface

Juan Jose Quintela Carreira (quintela@finisterrae.dc.fi.udc.es)
Tue, 24 Sep 1996 16:45:20 +0200

Date: Tue, 24 Sep 1996 16:45:20 +0200
From: quintela@finisterrae.dc.fi.udc.es (Juan Jose Quintela Carreira)
Message-Id: <9609241445.AA10783@dc.fi.udc.es>
To: caml-list@pauillac.inria.fr, christo@nextsolution.co.jp
Subject: Re: Need help: O'Caml C Interface

Hi,
If you changes the lines:
>
> value ocaml_getCharWidth(value code)
> {
> double x, y;
> Push_roots(r,1);
>
> r[0] = alloc_tuple(2);
> getCharWidth(Int_val(code),&x,&y);
- Store_double_val(Field(r[0],0),x);
+ modify(&Field(r[0],0),copy_double(x); /* Field(r[0],0)=copy_double(x)*/
- Store_double_val(Field(r[0],1),y);
+ modify(&Field(r[0],1),copy_double(y); /* Field(r[0],1)=copy_double(y)*/
> Pop_roots();
> return r[0];
> }
>

The coment sentences also work in this example, but the former work always,
For details see the manual section:
Chapter: Interfacing C with Objective Caml
Section: Living in harmony with the garbage collector

Regards, Juan.