English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    
Browse thread
caml_copy_string
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Goswin von Brederlow <goswin-v-b@w...>
Subject: Re: [Caml-list] caml_copy_string
Florent Monnier <monnier.florent@gmail.com> writes:

> Le dimanche 22 août 2010 01:30:28, Jeffrey Barber a écrit :
>> Is there a way to get a string from C to OCaml without the caml_copy_string
>> function, or is there a version that doesn't copy the string?
>
> an alternative method is to provide a string from ocaml to c then c fills this 
> buffer, then you can save allocations by reusing the same buffer, see:

Even better as buffer, for when you have a C function that takes a while
and should use caml_enter/leave_blocking_section(), is a Bigarray. The
data part of a bigarray is allocated outside the GC heap and remains
fixed.

MfG
        Goswin