bigos / idris-ffi-example

A minimal example of the Idris C FFI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

idris-ffi-example

This is a collection of examples of how to use the Idris FFI.

myFirstFFI

We have a C library testlib with a function int foo(int); that takes an int, adds 1 to the argument and returns the result. The Idris program calls foo with 42 as argument and then prints the result.

strings

We have two functions that return a char pointer. One of them will always return a C-string while the other always returns NULL. Note that the example doesn't work in v0.9.9.2.

About

A minimal example of the Idris C FFI

License:MIT License


Languages

Language:Idris 63.7%Language:C 23.3%Language:Makefile 12.5%Language:C++ 0.5%