problems exporting haskell functions
Juan Ignacio Garcia Garcia
jigg@ugr.es
Mon, 03 Sep 2001 12:47:16 +0200 (MEST)
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 <stdio.h>
#include <stdlib.h>
extern int f(int x);
int main( ){
int a;
a = f(5);
printf("%d\n",a);
return 0;
}
I have tried to compile it using the glasgow-extensions, but it has links problems.
Does anyone know if there is something wrong in my program?
Does anyone know where I can find a little example program where haskell functions are exported?
Thanks,
J.I. García