Le 20-12-21 19:37:54, Xavier Leroy a écrit : > On Sun, Dec 20, 2020 at 8:57 PM wrote: > > Hello, > > May global roots be initialized to (value)NULL ? > > > Yes, in the default OCaml configuration as of today. > > No, in the "no naked pointers" mode that was introduced in OCaml 4.02.0, made > much stricter in OCaml 4.12.0, and will be the default in OCaml 5.0. > > To be future-proof and on the safe side, I would suggest to initialize to e.g. > Val_unit. > Hello, Thanks for the help. I took a stronger path and initialized to (fun _ -> assert false). I added an issue in github for improving the documentation for typing constraints in the foreign C interface for OCaml. It seems I have no more segfault (not sure yet as the segfault was no reproductible). This is strange because I am using 4.11.1+flambda and the documentation says that using out of heap pointer (i.e. NULL ?) is depreacated for 4.11, but should work? Christophe > > I have a multithreaded program, which segfault in callback_asm, while I > think I respect all rules of c interfaces... Except maybe the above... > > > There is an OPAM compiler switch "4.10.0+nnpcheck" that adds run-time checks > for ill-formed values according to the no-naked-pointers rules.  Maybe you > could use it to rule out this potential problem. > > Hope this helps, > > - Xavier Leroy > > > > Chevets, > Christophe > -- > Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma > brièveté. >