Haskell and Maple FFI

Rafael Martinez Torres rmartine at fdi.ucm.es
Thu Oct 21 07:29:34 EDT 2004


> -------------
> A) The H98 Foreign Function Interface remakrs the next example to import
> from C.
>
> foreign import ccall "string.h strlen" cstrlen:: Ptr CChar -> IO CSize
>
> but trying
>
> foreign import ccall "maplec.h MapleKernelOptions" mapleKernelOptions ::
> MKernelVector ->  CString -> IO(ALGEB)
>
> gives a failure. (ghc-5.02.3)
> otium at avila:~/OpenMaple> ghc -cpp -fglasgow-exts -c maplec.hs -package lang
>
> maplec.hs:82:
>     `maplec.h MapleKernelOptions' is not a valid C identifier
>     When checking declaration:
> 	foreign import __ccall_GC maplec.h MapleKernelOptions mapleKernelOptions :: MKernelVector
> 										    -> CString
> 										       -> IO ALGEB

Done. Upgrading ghc-6.0.1 solves it.

Still waiting for answer C) on how marshalling C structures...



More information about the FFI mailing list