The error message is as follows
-------------------------------------- CallIncr.o: In function `sWM_entry': CallIncr.o:(.text+0xc5): undefined reference to `incr' collect2: ld returned 1 exit status --------------------------------------
I think that you forgot to link in your library, say libfoo.a that defines the function "incr".
ghc CallIncr.o -lfoo
If it is just a single file, say "foo.o", you say
ghc CallIncr.o foo.o
-- Daan.
where 'incr' is a toy function defined in 'mylib.h'. Obviously, in the foreign declaration I have changed 'myfun' by 'incr'. The compilation command is the typical
ghc -ffi -c CallIncr.hs
followed by
ghc -ffi CallIncr.o
which generate the previous error. Thanks again, gustavo
Manuel M T Chakravarty said:"Gustavo Villavicencio" <[EMAIL PROTECTED]> wrote,
I'm a new ffi user and I have some problems with foreign import declaration. I'm don't have any problem to access C standard functions. However, I cannot access to my own functions in mylib.h by means of
foreign import "mylib.h myfun" hmyfun :: ...
May be I'm omitting some compilation step or parameter also, since I'm applying the same compilation process to call C standard functions.
I'm working with ghc 5.04 on SuSe Linux 7.0.
You should say what goes wrong. Eg, paste the error messages of the compiler and/or linker into your email.
Manuel
_______________________________________________ FFI mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/ffi
_______________________________________________ FFI mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/ffi