Allocating aligned memory?

Claus Reinke claus.reinke at talk21.com
Thu Mar 9 10:04:24 EST 2006


>> For the moment I am using the C function memalign() like this:
>> 
>> foreign import ccall "static stdlib.h"
>>  memalign :: CInt -> CInt -> IO (Ptr CChar)

iirc, memalign is not provided on windows, nor by mingw.
so this wouldn't be portable.

claus
 
> Storable.alignment is not used, it is there for informational purposes 
> only - i.e. what alignment does this type need.  Foreign.malloc should 
> return memory aligned to the maximum alignment required by any primitive 
> type, and any C structure type (the same as malloc(), in other words).



More information about the Glasgow-haskell-users mailing list