caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Daniel Andor <da209@cam.ac.uk>
To: Artem Prisyznuk <tema@sit.kiev.ua>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] C -> CAML linking: loosing values in arrays??
Date: Sun, 12 Jan 2003 01:02:30 +0000	[thread overview]
Message-ID: <200301120102.30308.da209@cam.ac.uk> (raw)
In-Reply-To: <P6ZYKIB8RMMG3ZKGQKOKWNL2XBAOK.3e20a6ca@lena>

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


  reply	other threads:[~2003-01-12  1:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-11 19:07 Daniel Andor
2003-01-11 23:20 ` Artem Prisyznuk
2003-01-12  1:02   ` Daniel Andor [this message]
2003-01-15 15:10 ` Damien Doligez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200301120102.30308.da209@cam.ac.uk \
    --to=da209@cam.ac.uk \
    --cc=Daniel.Andor@physics.org \
    --cc=caml-list@inria.fr \
    --cc=tema@sit.kiev.ua \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).