dynamic-linker-template-0.1.1.0: Automatically derive dynamic linking methods from a data type.

Safe HaskellNone
LanguageHaskell98

System.Posix.DynamicLinker.Template

Synopsis

Documentation

makeDynamicLinker Source #

Arguments

:: Name

Name of the data type

-> Callconv

Calling convention: CCall or StdCall

-> Name

Name of the function used to transform symbol names

-> Q [Dec] 

Generate dynamic linking FFI methods for each field in the first parameter

data Callconv :: * #

Constructors

CCall 
StdCall 
CApi 
Prim 
JavaScript 

Instances

Eq Callconv 
Data Callconv 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Callconv -> c Callconv #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Callconv #

toConstr :: Callconv -> Constr #

dataTypeOf :: Callconv -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Callconv) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Callconv) #

gmapT :: (forall b. Data b => b -> b) -> Callconv -> Callconv #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Callconv -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Callconv -> r #

gmapQ :: (forall d. Data d => d -> u) -> Callconv -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Callconv -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Callconv -> m Callconv #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Callconv -> m Callconv #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Callconv -> m Callconv #

Ord Callconv 
Show Callconv 
Generic Callconv 

Associated Types

type Rep Callconv :: * -> * #

Methods

from :: Callconv -> Rep Callconv x #

to :: Rep Callconv x -> Callconv #

type Rep Callconv 
type Rep Callconv = D1 (MetaData "Callconv" "Language.Haskell.TH.Syntax" "template-haskell" False) ((:+:) ((:+:) (C1 (MetaCons "CCall" PrefixI False) U1) (C1 (MetaCons "StdCall" PrefixI False) U1)) ((:+:) (C1 (MetaCons "CApi" PrefixI False) U1) ((:+:) (C1 (MetaCons "Prim" PrefixI False) U1) (C1 (MetaCons "JavaScript" PrefixI False) U1))))

data DL :: * #

Flags for dlsym. Notice that Next might not be available on your particular platform! Use haveRtldNext.

If RTLD_DEFAULT is not defined on your platform, packDL Default reduces to nullPtr.

Instances

Show DL 

Methods

showsPrec :: Int -> DL -> ShowS #

show :: DL -> String #

showList :: [DL] -> ShowS #

data FunPtr a :: * -> * #

A value of type FunPtr a is a pointer to a function callable from foreign code. The type a will normally be a foreign type, a function type with zero or more arguments where

A value of type FunPtr a may be a pointer to a foreign function, either returned by another foreign function or imported with a a static address import like

foreign import ccall "stdlib.h &free"
  p_free :: FunPtr (Ptr a -> IO ())

or a pointer to a Haskell function created using a wrapper stub declared to produce a FunPtr of the correct type. For example:

type Compare = Int -> Int -> Bool
foreign import ccall "wrapper"
  mkCompare :: Compare -> IO (FunPtr Compare)

Calls to wrapper stubs like mkCompare allocate storage, which should be released with freeHaskellFunPtr when no longer required.

To convert FunPtr values to corresponding Haskell functions, one can define a dynamic stub for the specific foreign type, e.g.

type IntFunction = CInt -> IO ()
foreign import ccall "dynamic"
  mkFun :: FunPtr IntFunction -> IntFunction

Instances

Eq (FunPtr a) 

Methods

(==) :: FunPtr a -> FunPtr a -> Bool #

(/=) :: FunPtr a -> FunPtr a -> Bool #

Ord (FunPtr a) 

Methods

compare :: FunPtr a -> FunPtr a -> Ordering #

(<) :: FunPtr a -> FunPtr a -> Bool #

(<=) :: FunPtr a -> FunPtr a -> Bool #

(>) :: FunPtr a -> FunPtr a -> Bool #

(>=) :: FunPtr a -> FunPtr a -> Bool #

max :: FunPtr a -> FunPtr a -> FunPtr a #

min :: FunPtr a -> FunPtr a -> FunPtr a #

Show (FunPtr a) 

Methods

showsPrec :: Int -> FunPtr a -> ShowS #

show :: FunPtr a -> String #

showList :: [FunPtr a] -> ShowS #