RE: problems exporting haskell functions
15 Sep
2001
15 Sep
'01
12:05 a.m.
Hi there,
Hello, I have tried to export haskell functions, but I haven't been able to compile anything and obtain a executable file. My program has two parts. - Haskell part: module Hex where fh :: Int -> Int foreign export "f" fh :: Int -> Int fh x = 7
- C part: #include
#include extern int f(int x); int main( ){ int a; a = f(5); printf("%d\n",a); return 0; }
When you provide your own main() function, you have to arrange to initialize GHC's runtime system. I've attached some example code, and I've added some material to the User's Guide for the next release which explain how to do this. Cheers, Simon
8836
Age (days ago)
8836
Last active (days ago)
0 comments
1 participants
participants (1)
-
Simon Marlow