Skip to content

Add __attribute__((constructor))-equivalent pragma

It would be nice to let one's library perform initialization tasks at load time. Then the integer-gmp allocation functions could be changed from within haskell and various other FFI libraries would be easier to bind to. As for syntax, maybe something like the following would work?

{-# CONSTRUCTOR f #-} f :: IO () f = ...

Trac metadata
Trac field Value
Version 6.11
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information