Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Interfaçage C/CAML
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-08-14 (16:36)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: Interfaçage_C/CAML
> [French>
> Si je le comprends bien, le problem c'est l'utilisation du
> "Store_double_field". La solution dans ce cas serait d'essayer le macro
> "Double_field" en place de l'autre macro.
> C'est souvant un source des erreurs - peut-etre on pourrait changer le nom
> de "Store_double_field"? Il me semble que la plupart des programmeurs
> soient confuses par "Store"...
> "Store_..." ne doit etre utilise que avec des "blocs structures", ou il
> sont obligatoirs.

> [English]
> It seems that a common bug has struck again: using "Store_{whatever}" in
> C-interfaces is only allowed (and then mandatory) with structured blocks.
> Using it for anything else may crash the GC.

No, no, no!  Store_field can only be used (and is mandatory) for
structured blocks (with tag < No_scan_tag), but Store_double_field
can be used (and is mandatory) for blocks with tag Double_array_tag.

(If you do Double_field(array, n) = d, you'll run into alignment
problems on some platforms, e.g. the Sparc and Mips.)

So, Nicolas's code seems correct in this respect.

Nicolas: could you please send to (and not to caml-list)
a complete program that reproduces the crash?  There's not enough
details in your message to understand what goes wrong.

- Xavier Leroy