ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.Types.ForeignStubs

Description

Foreign export stubs

Synopsis

- data ForeignStubs
  - = NoStubs
  - | ForeignStubs CHeader CStub
- newtype CHeader = CHeader {
  - getCHeader :: SDoc
  }
- data CStub = CStub {
  - getCStub :: SDoc
  - getInitializers :: [CLabel]
  - getFinalizers :: [CLabel]
  }
- initializerCStub :: Platform -> CLabel -> SDoc -> SDoc -> CStub
- finalizerCStub :: Platform -> CLabel -> SDoc -> SDoc -> CStub
- appendStubC :: ForeignStubs -> CStub -> ForeignStubs

# Documentation

data ForeignStubs Source #

Foreign export stubs

Constructors

NoStubs | We don't have any stubs
ForeignStubs CHeader CStub | There are some stubs. Parameters: 1) Header file prototypes for "foreign exported" functions 2) C stubs to use when calling "foreign exported" functions

newtype CHeader Source #

Constructors

CHeader |

Fields

- getCHeader :: SDoc

#### Instances

Instances details

Monoid CHeader Source # |
Instance details Defined in GHC.Types.ForeignStubs Methods mempty :: CHeader Source # mappend :: CHeader -> CHeader -> CHeader Source # mconcat :: [CHeader] -> CHeader Source #
Semigroup CHeader Source # |
Instance details Defined in GHC.Types.ForeignStubs Methods (<>) :: CHeader -> CHeader -> CHeader Source # sconcat :: NonEmpty CHeader -> CHeader Source # stimes :: Integral b => b -> CHeader -> CHeader Source #

data CStub Source #

Constructors

CStub |

Fields

- getCStub :: SDoc
- getInitializers :: [CLabel]

  Initializers to be run at startup See Note [Initializers and finalizers in Cmm] in GHC.Cmm.InitFini.

- getFinalizers :: [CLabel]

  Finalizers to be run at shutdown

#### Instances

Instances details

Monoid CStub Source # |
Instance details Defined in GHC.Types.ForeignStubs Methods mempty :: CStub Source # mappend :: CStub -> CStub -> CStub Source # mconcat :: [CStub] -> CStub Source #
Semigroup CStub Source # |
Instance details Defined in GHC.Types.ForeignStubs Methods (<>) :: CStub -> CStub -> CStub Source # sconcat :: NonEmpty CStub -> CStub Source # stimes :: Integral b => b -> CStub -> CStub Source #

initializerCStub :: Platform -> CLabel -> SDoc -> SDoc -> CStub Source #

`initializerCStub fn_nm decls body` is a `CStub` containing C initializer function (e.g. an entry of the `.init_array` section) named `fn_nm` with the given body and the given set of declarations.

finalizerCStub :: Platform -> CLabel -> SDoc -> SDoc -> CStub Source #

`finalizerCStub fn_nm decls body` is a `CStub` containing C finalizer function (e.g. an entry of the `.fini_array` section) named `fn_nm` with the given body and the given set of declarations.

appendStubC :: ForeignStubs -> CStub -> ForeignStubs Source #