Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: Need help: O'Caml C Interface
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: quintela@f...
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.