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
c binding question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-02-22 (08:09)
From: Michael Wohlwend <micha-1@f...>
Subject: c binding question

I want to make an interface to a c-lib in which some function take a char* as 
a parameter and store this paramenter in their internal variables.
I have done this this way:

I copy the ocaml-string to a new c-string and I allocated a custom block to 
store the abstract datatype of the lib together with the allocated char* for 
that string. The finalize function of that custom block releases the 
allocated memory of the string and cleans up the rest... 

Is this the correct way to do this?