summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2022-04-22 23:50:59 +0200
committerTom Smeding <tom@tomsmeding.com>2022-04-22 23:50:59 +0200
commit6080ed0182e65d9cd51b9a1d7209ff82a5e41fa5 (patch)
tree89015f361fae6b8e7555ade239b6ff2179d24658
parent84a8967044dc5b8879033a07f5ba7940852510d9 (diff)
Only works from ghc 8.10 onwards
-rw-r--r--ghc-gc-hook.cabal5
-rw-r--r--src/GHC/GC_Hook.hs9
2 files changed, 10 insertions, 4 deletions
diff --git a/ghc-gc-hook.cabal b/ghc-gc-hook.cabal
index b7ed15d..c39b3c2 100644
--- a/ghc-gc-hook.cabal
+++ b/ghc-gc-hook.cabal
@@ -21,7 +21,7 @@ library
hs-source-dirs: src
c-sources: cbits/hook.c
build-depends:
- base >= 4.13 && < 4.17,
+ base >= 4.14 && < 4.17,
clock
default-language: Haskell2010
cc-options: -Wall
@@ -33,10 +33,11 @@ test-suite test
hs-source-dirs: test
c-sources: test/cbits/testhook.c
build-depends:
- base >= 4.13 && < 4.17,
+ base >= 4.14 && < 4.17,
ghc-gc-hook,
clock
default-language: Haskell2010
+ cc-options: -Wall
ghc-options: -Wall -threaded
source-repository head
diff --git a/src/GHC/GC_Hook.hs b/src/GHC/GC_Hook.hs
index b3e1947..250441c 100644
--- a/src/GHC/GC_Hook.hs
+++ b/src/GHC/GC_Hook.hs
@@ -1,3 +1,7 @@
+{-|
+Make use of GHC's GC hook functionality from Haskell. This is still a very
+bare-bones API.
+-}
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE TypeApplications #-}
@@ -109,8 +113,9 @@ enableGClogging yes = c_gchook_enable_logging (CBool (if yes then 1 else 0))
-- | Set a C function to be called after every GC. Use this in the following manner:
--
-- * Create a file @cbits/something.c@ in your project (the actual file name
--- doesn't matter), and add @c-sources: cbits/something.c@ to the stanza of
--- the correct component in your .cabal file.
+-- doesn't matter), and add @c-sources: cbits/something.c@ (and, if you wish,
+-- @cc-options: -Wall@) to the stanza of the correct component in your .cabal
+-- file.
-- * Put the following in it: (The function names are unimportant.)
--
-- > #include "Rts.h"