[haskell-llvm] mapping CSize to i32 or i64

Henning Thielemann lemming at henning-thielemann.de
Sun Dec 19 15:06:12 EST 2010

I am about to rewrite LLVM.Core.malloc and LLVM.Core.free using the 
functions from C's standard library, first because the according LLVM 
intrinsics are deprecated and second because the malloc intrinsic in 
LLVM-2.7 and 2.8 becomes unusable due to the bug

However, I am uncertain how to declare 'malloc' the right way using 
externFunction. I expect that 'size_t' is Word32 or Word64 depending on 
the machine word size. Unfortunately, CSize is not an LLVM type. My first 
idea was to abuse a void pointer type for the memory size argument, since 
pointers and size_t have probably the same number of bits. However 
declaring 'malloc' this way, will interfer with custom 'malloc' 
declarations of users of the 'llvm' package.

More information about the Haskell-llvm mailing list