[Haskell-cafe] FFI, C/C++ and undefined references
bulat.ziganshin at gmail.com
Thu Jan 14 02:56:08 EST 2010
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
> 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
> 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
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe