ffi

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Wed, 11 Dec 2002 17:37:50 +0000


Martin Huschenbett <huschi.spez@gmx.de> writes:

> main :: IO ()
> main = do
> 	-- do something
> 	cfun -- I wan't to call the function written in C here
> 	-- do again something
> 
> And now my question is: How do i realize this?
> Can you please tell me how write a binding and how tu run ghc.

foreign import ccall "cfun" cfun :: IO ()

$ cc -c cfile.c
$ ghc -o myprog Main.hs cfile.o

Regards,
    Malcolm