caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* C Interface and float record
@ 2009-06-16  8:40 Christoph Bauer
  2009-06-16  9:44 ` [Caml-list] " Christophe TROESTLER
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Bauer @ 2009-06-16  8:40 UTC (permalink / raw)
  To: caml-list

Hi,

I have a type

type t = {
   f1 : float;
   f2 : float;
   f3 : float;
}

and a external C-function should allocate this as for the result.

Do I have to use

   caml_alloc(6, Double_array_tag)

to allocate such a record? I'm unsure about the 6.

Could I also use caml_alloc_small? 

Thanks,

Christoph Bauer


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] C Interface and float record
  2009-06-16  8:40 C Interface and float record Christoph Bauer
@ 2009-06-16  9:44 ` Christophe TROESTLER
  2009-06-16 14:57   ` Christoph Bauer
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe TROESTLER @ 2009-06-16  9:44 UTC (permalink / raw)
  To: christoph.bauer; +Cc: OCaml Mailing List

On Tue, 16 Jun 2009 10:40:31 +0200, Christoph Bauer wrote:
> 
> type t = {
>    f1 : float;
>    f2 : float;
>    f3 : float;
> }
> 
> and a external C-function should allocate this as for the result.
> 
> Do I have to use
> 
>    caml_alloc(6, Double_array_tag)

caml_alloc(3 * Double_wosize, Double_array_tag)

would be better (portable between 32 and 64 bits).

C.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [Caml-list] C Interface and float record
  2009-06-16  9:44 ` [Caml-list] " Christophe TROESTLER
@ 2009-06-16 14:57   ` Christoph Bauer
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Bauer @ 2009-06-16 14:57 UTC (permalink / raw)
  To: Christophe TROESTLER; +Cc: OCaml Mailing List

> > type t = {
> >    f1 : float;
> >    f2 : float;
> >    f3 : float;
> > }
> > 
> > and a external C-function should allocate this as for the result.
> > 
> > Do I have to use
> > 
> >    caml_alloc(6, Double_array_tag)
> 
> caml_alloc(3 * Double_wosize, Double_array_tag)
> 
> would be better (portable between 32 and 64 bits).


Thanks Christophe,

i use Double_wosize and it works fine

Christoph


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-16 14:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-16  8:40 C Interface and float record Christoph Bauer
2009-06-16  9:44 ` [Caml-list] " Christophe TROESTLER
2009-06-16 14:57   ` Christoph Bauer

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).