Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] C -> CAML linking: loosing values in arrays??
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel Andor <da209@c...>
Subject: Re: [Caml-list] C -> CAML linking: loosing values in arrays??
Thanks to you and Basile, who also replied.

I think I now understand that I need to use the more low-level alloc() 
function with the appropriate tag, since there doesn't seem to be a version 
of alloc_array() suitable for doubles.

At the moment my main worry is that I'm allocating new arrays to pass to the 
function faster than the gc can clean them up... I need to find out about 
hanging on to allocated values on the C side of things.

Thanks,
Daniel.

On Saturday 11 January 2003 11:20 pm, Artem Prisyznuk wrote:
> 11.01.03 22:07:51, Daniel Andor <da209@cam.ac.uk> wrote:
> >If I pass a non-array double using copy_double(), it works and I get the
> >correct number on the other side.
> >
> >Any ideas as to where I've gone wrong?
>
> From Caml manual:
>
> ....
> 18.3.3
> Arrays
>
> Arrays of integers and pointers are represented like tuples, that is, as
> pointers to blocks tagged 0. They are accessed with the Field macro for
> reading and the modify function for writing.
>
> Arrays of floating-point numbers (type float array) have a _special,
> unboxed_, more efficient representation. These arrays are represented by
> pointers to blocks with tag Double_array_tag. They should be accessed with
> the Double_field and Store_double_field macros. ....
>
> >Thanks,
> >Daniel.
> >-------------------
> >To unsubscribe, mail caml-list-request@inria.fr Archives:
> > http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ:
> > http://caml.inria.fr/FAQ/ Beginner's list:
> > http://groups.yahoo.com/group/ocaml_beginners
>
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr Archives:
> http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ:
> http://caml.inria.fr/FAQ/ Beginner's list:
> http://groups.yahoo.com/group/ocaml_beginners

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners