16 Feb
2007
16 Feb
'07
6:04 a.m.
On Thu, Feb 15, 2007 at 11:56:58PM -0600, Rob Hoelz wrote:
I'm working with the Foreign module, and I need to allocate a pointer to a pointer (in C, a char **). The problem is, I don't know how to find out the size of a char * in Haskell. Here's the basic layout of the code:
allocaBytes len $ \ array -> ... -- len is the size of the char ** to be allocated times sizeof(char *).
import Foreign.Marshal.Array allocaArray nr_of_pointers $ \arrar -> ... automatically figures the sizeof(char *) if you really want to know ... sizeOf (undefined ;: Ptr CChar) Stefan