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
OCaml Int64 <-> C int64_t
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-08-18 (18:47)
From: Mathias Kende <mathias@k...>
Subject: Re: [Caml-list] OCaml Int64 <-> C int64_t
Le mercredi 18 août 2010 à 14:16 -0400, Jianzhou Zhao a écrit :
> Does caml_copy_int64 do all I want?

I believe so, but then I don't know what you want...

> int64_t C_fun();
> CAMLprim value stub()
> {
>   return (caml_copy_int64 (C_fun()));
> }
> Do we still need I64_of_intnat? It is not included in <caml/alloc.h>
> or other headers.

INT64_of_intnat is an internal macro. There is no reason to use it. Your
snippet of code seems correct, but remember that caml_copy_int64 will
allocate values in the heap so you need to use the CAMLparam/CAMLreturn
macro if your function receives arguments from the caml world.