Ptr

module Foreign.Ptr
base Foreign.Ptr
This module provides typed pointers to foreign data. It is part of the Foreign Function Interface (FFI) and will normally be imported via the Foreign module.
data Ptr a
base Foreign.Ptr, base GHC.Exts
A value of type Ptr a represents a pointer to an object, or an array of objects, which may be marshalled to or from Haskell values of type a. The type a will often be an instance of class Foreign.Storable.Storable which provides the marshalling operations. However this is not essential, and you can provide your own operations to access the pointer. For example you might write small foreign functions to get or set the fields of a C struct.
Ptr :: Addr# -> Ptr a
base GHC.Exts
ptrToIntPtr :: Ptr a -> IntPtr
base Foreign.Ptr
casts a Ptr to an IntPtr
ptrToWordPtr :: Ptr a -> WordPtr
base Foreign.Ptr
casts a Ptr to a WordPtr
addForeignPtrFinalizer :: FinalizerPtr a -> ForeignPtr a -> IO ()
base Foreign.ForeignPtr
This function adds a finalizer to the given foreign object. The finalizer will run before all other finalizers for the same object which have already been registered.
addForeignPtrFinalizer :: ForeignPtr a -> IO () -> IO ()
base Foreign.Concurrent
This function adds a finalizer to the given ForeignPtr. The finalizer will run after the last reference to the foreign object is dropped, but before all previously registered finalizers for the same object.
addForeignPtrFinalizerEnv :: FinalizerEnvPtr env a -> Ptr env -> ForeignPtr a -> IO ()
base Foreign.ForeignPtr
Like addForeignPtrFinalizerEnv but allows the finalizer to be passed an additional environment parameter to be passed to the finalizer. The environment passed to the finalizer is fixed by the second argument to addForeignPtrFinalizerEnv
advancePtr :: Storable a => Ptr a -> Int -> Ptr a
base Foreign.Marshal.Array
Advance a pointer into an array by the given number of elements
alignPtr :: Ptr a -> Int -> Ptr a
base Foreign.Ptr
Given an arbitrary address and an alignment constraint, alignPtr yields the next higher address that fulfills the alignment constraint. An alignment constraint x is fulfilled by any address divisible by x. This operation is idempotent.
castForeignPtr :: ForeignPtr a -> ForeignPtr b
base Foreign.ForeignPtr
This function casts a ForeignPtr parameterised by one type into another type.
castFunPtr :: FunPtr a -> FunPtr b
base Foreign.Ptr
Casts a FunPtr to a FunPtr of a different type.
castFunPtrToPtr :: FunPtr a -> Ptr b
base Foreign.Ptr
Casts a FunPtr to a Ptr. Note: this is valid only on architectures function pointers range over the same set of addresses, and should only be used for bindings to external libraries whose interface already relies on this assumption.
castPtr :: Ptr a -> Ptr b
base Foreign.Ptr
The castPtr function casts a pointer from one type to another.
castPtrToFunPtr :: Ptr a -> FunPtr b
base Foreign.Ptr
Casts a Ptr to a FunPtr. Note: this is valid only on architectures function pointers range over the same set of addresses, and should only be used for bindings to external libraries whose interface already relies on this assumption.
castPtrToStablePtr :: Ptr () -> StablePtr a
base Foreign.StablePtr
The inverse of castStablePtrToPtr, i.e., we have the identity > sp == castPtrToStablePtr (castStablePtrToPtr sp) for any stable pointer sp on which freeStablePtr has not been executed yet. Moreover, castPtrToStablePtr may only be applied to pointers that have been produced by castStablePtrToPtr.
castStablePtrToPtr :: StablePtr a -> Ptr ()
base Foreign.StablePtr
Coerce a stable pointer to an address. No guarantees are made about the resulting value, except that the original stable pointer can be recovered by castPtrToStablePtr. In particular, the address may not refer to an accessible memory location and any attempt to pass it to the member functions of the class Foreign.Storable.Storable leads to undefined behaviour.
data CIntPtr
base Foreign.C.Types
data CPtrdiff
base Foreign.C.Types
Haskell type representing the C ptrdiff_t type.
data CUIntPtr
base Foreign.C.Types

Show more results