[Haskell-beginners] scotty + ffi segfault

Brandon Allbery allbery.b at gmail.com
Fri Mar 14 20:52:03 UTC 2014


On Fri, Mar 14, 2014 at 4:46 PM, Miro Karpis <miroslav.karpis at gmail.com>wrote:

> setmodulestring :: String -> String -> IO CInt
> setmodulestring param value = do
>  cParam <- newCString param
> cValue <- newCString value
> let cParamLength = fromIntegral $ length param ::CInt
>     cValueLength = fromIntegral $ length value ::CInt
>     setVarInArray = (-1)::CInt
> result <- c_setmodulestring cParam cParamLength cValue cValueLength
> setVarInArray
>  return result
>

The path you show earlier looks like Windows; you probably want CWString
for Win32 API functions (so newCWString etc.).

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140314/e6a9ef9a/attachment.html>


More information about the Beginners mailing list