@@ -18,6 +18,9 @@ mystruct = foreign FFI_C "&mystruct" (IO Ptr)
1818print_mystruct : IO ()
1919print_mystruct = foreign FFI_C "print_mystruct" (IO ())
2020
21+calc_struct : Ptr -> IO Ptr
22+calc_struct = foreign FFI_C "calc_struct" (Ptr -> IO Ptr)
23+
2124test1 : Composite
2225test1 = STRUCT [I8, I64]
2326
@@ -46,3 +49,10 @@ main = do
4649 print !(peek I32 f1)
4750 withAlloc PTR $ \p =>
4851 poke PTR p fms
52+ res <- withAlloc test1 $ \p => do
53+ let f1 = (test1 # 0) p
54+ let f2 = (test1 # 1) p
55+ poke I8 f1 42
56+ poke I64 f2 1125899906842624
57+ calc_struct p
58+ free res