blob: 892f4cd56339f3f86b38d657776ab69e8cea5b09 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
March 2019
# Haskell - Foreign Function Interface
Haskell's FFI allows easily to cooperate with other languages. Foreign functions can call Haskell code and vice versa.
Simple examples can be found in my git repository [1]. For now, the provided Makefile exposes two interesting targets:
* **c\_from\_hask** - simple program with a C function called from Haskell.
* **hask\_from\_c** - simple programm with a Haskell function called from C.
The next step is to pass more complicated structures via _ForeignPtr_'s.
## Notes
* since version 8.4 GHC guarantees that garbage collection will never occur during an unsafe call.
## Ref
* [1] <https://gitweb.softwarefools.com/?p=miguel/haskell.git;a=tree;f=ffi>
* [2] <https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ffi-chap.html#>
* [3] <https://wiki.haskell.org/Foreign_Function_Interface>
|