English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Wrapping OCaml function returning a variant
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-03-28 (12:13)
From: Joel Reymont <joelr1@g...>
Subject: Re: [Caml-list] Wrapping OCaml function returning a variant

On Mar 28, 2007, at 1:55 PM, Serge Aleynikov wrote:

> If you are using caml_copy_string() or caml_alloc_string() they  
> allocate strings on OCaml's heap, and will be automatically garbage  
> collected.

How do I pass a C string into OCaml if the assumption is that it will  
not be modified? Do I still need to copy it with caml_copy_string?

I don't think I need to allocate strings on the OCaml heap from C as  
the string given to OCaml will be allocated on the C heap and the  
string returned from OCaml will be garbage-collected automatically.

	Thanks, Joel