[Haskell-cafe] FFI, C/C++ and undefined references
Bulat Ziganshin
bulat.ziganshin at gmail.com
Thu Jan 14 02:56:08 EST 2010
Hello DNM,
Thursday, January 14, 2010, 7:07:43 AM, you wrote:
> Yes, I thought of doing this, but then thought it was better to use a
> so-called "managed" foreign pointer via newForeignPtr.
i recommend to use Ptr and switch to ForeignPtr only when you will
study how to use it. overall, unsafe* functions are really unsafe, and
using them without learning will lead to mysterious problems. it's
like painting with eyes closed
> Good point. I would do this if I planned to train or update the language
> model
> from within Haskell, but, as it stands, I just want to train it once (at the
> command line,
> using the built-in mechanisms of SRILM) and then read in the ARPA-formatted
> language
> model file for use in Haskell.
you may add problems by using unsafePerformIO. i recommend you to
learn first how to manage FFI without it, make program work, and only
then try to use it. eat elephant in small pieces!
look into http://haskell.org/haskellwiki/IO_inside
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe
mailing list