Hello,

I have been working with a program that uses FFI to communicate with R for
several
years, but today there is a segmentation fault while importing functions or
data from R.
Before giving up on this project, I'm posting a few detail here, in case
anybody has
ideas...perhaps something changed with FFI?

I tried going back to the version of R and ghc where it worked using stack,
but no luck.
The Haskell code is a modification of the code in the package hR (by Dylan
Simon),
and here is a function that fails that worked before. It fails with a seg
fault
on the call to r_install. (s = "parse" when it fails)...

foreign import ccall safe "Rf_install" r_Install :: CString -> IO R_EXP
rInstall :: String -> IO REXP
rInstall s = withCString s r_Install >>= extREXP

The types are defined as follows...

extREXP :: R_EXP -> IO REXP
extREXP = newForeignPtr_

data REXPREC

type R_EXP = Ptr REXPREC

type REXP = ForeignPtr REXPREC

newtype SEXP a = SEXP { unSEXP :: REXP } deriving (Eq, Show)

Please let me know if you see anything obviously wrong and in need
of improvement, perhaps because of changes to the FFI.

Thanks,
Dominick
_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to