on master help sign in
Merge pull request #4632 from bigos/patch-1

Update ffi.rst to show example of correct including C code and exampl…

commit03d9188ffba36608bd70d603ddc0d325ecc915ec authorNiklas Larsson <metaniklas@gmail.com> dateWed 26 Dec 2018, 14:36 (8 years ago) parent32940bea0a9b79
1 file changed+18
docs/reference/ffi.rst+18
docs/reference/ffi.rst+18
@@ -115,6 +115,24 @@ For C, this is:
115115 FFI_C : FFI
116116 FFI_C = MkFFI C_Types String String
117117
118+Linking foreign code
119+====================
120+
121+This is the example of linking C code.
122+
123+.. code-block:: idris
124+ %include C "mylib.h"
125+ %link C "mylib.o"
126+
127+Example Makefile
128+
129+.. code-block:: shell
130+ DEFAULT: mylib.o main.idr
131+ idris main.idr -o executableFile
132+
133+ clean:
134+ rm -f executableFile mylib.o main.ibc
135+
118136Foreign calls
119137=============
120138