File: LibFFI.hs

package info (click to toggle)
haskell-libffi 0.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 92 kB
  • sloc: haskell: 316; makefile: 5
file content (28 lines) | stat: -rw-r--r-- 715 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{- |
This is the only module that normal users should need to import.

As an example, allocate 1GB of memory, zero it, and crash:

@
import System.Posix.DynamicLinker
import Foreign.Ptr
import Foreign.LibFFI

main = do
    malloc <- dlsym Default \"malloc\"
    memset <- dlsym Default \"memset\"
    p <- callFFI malloc (retPtr retVoid) [argCSize (2^30)]
    callFFI memset (retPtr retVoid) [argPtr p, argCInt 0, argCSize (2^30)]
    callFFI memset (retPtr retVoid) [argPtr nullPtr, argCInt 0, argCSize 1]
@
-}
module Foreign.LibFFI
    (Arg
    ,RetType
    ,callFFI
    ,withRetType
    ,module Foreign.LibFFI.Types
    ) where

import Foreign.LibFFI.Base
import Foreign.LibFFI.Types