stevelihn: > On Dec 11, 2007 11:16 PM, Don Stewart <[EMAIL PROTECTED]> wrote: > > > 2. It offers strong support for integration with other languages and > > > tools > > > (FFI? Is the support strong?) > > > > 2. The FFI in Haskell is perhaps the most powerful out there. > > You can import C or export Haskell to C with a single line FFI decl. > > > Don, > I am a newbie on FFI, but have been interested in looking into it. If > I google on "haskell FFI", what I find is typically: > 1. The official Haskell 98 FFI 1.0 > 2. The FFI preprocessor -- greencard on haskell.org, where several > other preprocessors are listed (in the Link section): HaskellDirect, C > to Haskell, hsc2hs (included in GHC distributions), QForeign, KDirect.
Right. Most of those are out of date. > The FFI 1.0 API is certainly the most robust tool. However, the > existence of preprocessors seem to suggest (at least very enticing) > that the use of a preprocessor would make life easier. Yes, that's the foundation. > But when I dig deeper, several of them have not had any release in > (more than) 3 years. The only exception seem to be "C to Haskell", > which is part of gtk2hs, and hsc2hs, being part of GHC. It immediately > becomes confusing which tool I should use if I were to work on a FFI > project... Can you shed some light on this? There are three approaches, depending on the size of your project. Write your ow FFI decls manually. - Good when you have a small job - and the C types are simple - example: strlen Use hsc2hs: - good for more complex C code. Scales nicely. But a bit tedious. - examples: pcre.h X11.h Use c2hs: - more automated than hsc2hs - less common - scriptable - examples: gtk2hs I use hsc2hs mostly. -- Don _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe