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
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?