[Haskell-beginners] help with FFI: passing char* to dll function + pointer freeing

Brandon Allbery allbery.b at gmail.com
Sat Sep 21 21:48:15 CEST 2013


On Sat, Sep 21, 2013 at 3:25 PM, Miro Karpis <miroslav.karpis at gmail.com>wrote:

> Thanks so far, but I'm still having troubles with converting String to
> CString.... The error I'm getting is:
>
>  Couldn't match type `IO CString' with `Ptr CChar'
>  Expected type: CString
>    Actual type: IO CString
>
(...)

>   let param = newCString "someString"
>

Don't use let there; newCString is in IO.

    param <- newCString "someString"

-- 
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/20130921/d2086d9d/attachment.htm>


More information about the Beginners mailing list