summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/unload_multiple_objs/D.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/rts/unload_multiple_objs/D.hs')
-rw-r--r--testsuite/tests/rts/unload_multiple_objs/D.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/tests/rts/unload_multiple_objs/D.hs b/testsuite/tests/rts/unload_multiple_objs/D.hs
new file mode 100644
index 0000000000..39a20f6fbb
--- /dev/null
+++ b/testsuite/tests/rts/unload_multiple_objs/D.hs
@@ -0,0 +1,16 @@
+module D where
+
+import Foreign.StablePtr
+
+id4 :: Int
+id4 = 4
+
+createHeapObjectD :: IO (StablePtr [Int])
+createHeapObjectD = do
+ newStablePtr [2+id4]
+
+freeHeapObjectD :: StablePtr [Int] -> IO ()
+freeHeapObjectD obj = freeStablePtr obj
+
+foreign export ccall createHeapObjectD :: IO (StablePtr [Int])
+foreign export ccall freeHeapObjectD :: StablePtr [Int] -> IO ()