native: demo for a call to haskell functions at runtime
[mate.git] / Mate / GarbageAlloc.hs
index 1a272fbaedbbd02265d47a3a72785ab5b755cd8e..e7c1cc955a266ab09fb3691945fb8aadd1d5272d 100644 (file)
@@ -6,9 +6,7 @@ module Mate.GarbageAlloc where
 import Foreign
 import Foreign.C
 
-#ifdef DEBUG
 import Text.Printf
-#endif
 import Mate.Debug
 
 -- unified place for allocating Memory
@@ -24,9 +22,16 @@ mallocString size = do
   printfStr "mallocString: %d\n" size
   mallocBytes size
 
-foreign export ccall mallocObject :: Int -> IO CUInt
-mallocObject :: Int -> IO CUInt
+foreign export ccall mallocObject :: Int -> IO CPtrdiff
+mallocObject :: Int -> IO CPtrdiff
 mallocObject size = do
   ptr <- mallocBytes size
   printfStr "mallocObject: %d\n" size
   return $ fromIntegral $ ptrToIntPtr ptr
+
+-- TODO: delete me
+foreign export ccall demoInterfaceCall :: CUInt -> IO ()
+demoInterfaceCall :: CUInt -> IO ()
+demoInterfaceCall val = do
+  printf "demoInterfaceCall: 0x%08x\n" (fromIntegral val :: Word32)
+  return ()