diff options
Diffstat (limited to 'testsuite/tests/th/TH_StaticPointers.hs')
-rw-r--r-- | testsuite/tests/th/TH_StaticPointers.hs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/th/TH_StaticPointers.hs b/testsuite/tests/th/TH_StaticPointers.hs new file mode 100644 index 0000000000..f8045426cc --- /dev/null +++ b/testsuite/tests/th/TH_StaticPointers.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE StaticPointers #-} + +-- |A test to load symbols produced by the static form. +-- +-- First we have this program load itself using the GHC API. +-- Then we look for the symbols that the static form should have +-- exposed and use the values found at the symbol addresses. +-- +-- Note that we lookup for 'g' in symbol tables which does not appear +-- in the export list of Main. +-- +module Main(main) where + +import GHC.StaticPtr + +main = print $ deRefStaticPtr $([| static g :: StaticPtr String |]) + +g = "found" |