summaryrefslogtreecommitdiff
path: root/ffi/foomain.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2019-03-30 16:08:18 +0100
committerMiguel <m.i@gmx.at>2019-03-30 16:08:18 +0100
commitb45e37124d855bdf3365e8202559c45cf28e9d88 (patch)
tree1741d955c0c8e023a0c3bead76795bfbd895e7bb /ffi/foomain.c
parent1ac8773f20c25b9ebbe559efe25591ba7a24acdb (diff)
first success with ffi (Call hask from c)
Diffstat (limited to 'ffi/foomain.c')
-rw-r--r--ffi/foomain.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/ffi/foomain.c b/ffi/foomain.c
new file mode 100644
index 0000000..70d891c
--- /dev/null
+++ b/ffi/foomain.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+#include "HsFFI.h"
+
+#ifdef __GLASGOW_HASKELL__
+#include "Foo_stub.h"
+#endif
+
+int main(int argc, char *argv[])
+{
+ int i;
+
+ hs_init(&argc, &argv);
+
+ for (i = 0; i < 5; i++) {
+ printf("%d\n", foo(2500+i));
+ printf("%d\n", foo(2500+i));
+ }
+
+ hs_exit();
+ return 0;
+}