, touchForeignPtr
, castForeignPtr
-#ifndef __NHC__
, mallocForeignPtr
, mallocForeignPtrBytes
, mallocForeignPtrArray
, mallocForeignPtrArray0
-#endif
)
where
, unsafeForeignPtrToPtr
, touchForeignPtr
, castForeignPtr
+ , Storable(sizeOf)
+ , malloc, mallocBytes, finalizerFree
)
#endif
unsafeForeignPtrToPtr = foreignPtrToPtr
#endif
-#ifdef __HUGS__
+#ifndef __GLASGOW_HASKELL__
mallocForeignPtr :: Storable a => IO (ForeignPtr a)
mallocForeignPtr = do
r <- malloc
mallocForeignPtrBytes n = do
r <- mallocBytes n
newForeignPtr r finalizerFree
-#endif /* __HUGS__ */
+#endif /* __HUGS__ || __NHC__ */
-#ifndef __NHC__
mallocForeignPtrArray :: Storable a => Int -> IO (ForeignPtr a)
mallocForeignPtrArray = doMalloc undefined
where
mallocForeignPtrArray0 :: Storable a => Int -> IO (ForeignPtr a)
mallocForeignPtrArray0 size = mallocForeignPtrArray (size + 1)
-#endif