summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/TH_StaticPointers.hs
blob: f8045426cc427807448fcd9c01a74e1e3727378d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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"