stableptr005.hs 612 Bytes
Newer Older
1 2 3
-- !!! triggered a temporary bug in freeStablePtr around 20020424

module Main where
4
import Foreign.StablePtr (newStablePtr, freeStablePtr)
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

data Foo = A | B | C | D

main :: IO ()
main = do aSPtr <- newStablePtr A
          bSPtr <- newStablePtr B
          cSPtr <- newStablePtr C
          cSPtr' <- newStablePtr C
          freeStablePtr aSPtr
          freeStablePtr bSPtr
          freeStablePtr cSPtr
          freeStablePtr cSPtr'
          aSPtr <- newStablePtr A
          bSPtr <- newStablePtr B
          cSPtr <- newStablePtr C
          dSPtr <- newStablePtr D
          print "Hello World"