Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 707 Bytes

README.md

File metadata and controls

31 lines (20 loc) · 707 Bytes

Foreing Function Interface

This haskell package allows binding functions from other programming languages t be called inside haskell code and viceversa.

In order to call a C functrion we first need to import the external function using the foreing module and then bind the equivalent types from C.

The first step is to call he Language Extension

{-# LANGUAGE ForeignFunctionInterface #-}

Import foreing modules

import Foreign
import Foreign.C.Types

For this example we are using the math C library

foreign import ccall "math.h sin"
     c_sin :: CDouble -> CDouble

Example

hs-concepts

ForeignFunctionC