[Haskell-iPhone] FFI for living in C

David Pollak feeder.of.the.bears at gmail.com
Sun Dec 2 05:39:02 CET 2012


FWIW, I put together this project a while back:
https://github.com/dpp/LispHaskellIPad It's some calls between GHC and iOS.

There's also https://github.com/visi-lang/visi which has some iOS
interactions with Haskell

On Sat, Dec 1, 2012 at 3:43 PM, Luke Iannini <lukexipd at gmail.com> wrote:

> Hi guys,
>
> It's also possible to start the Haskell runtime from within C/C++,
> using the hs_init() and hs_exit() functions (you can just call them
> each one at startup and shutdown before calling into any Haskell code
> that's been "foreign export"ed), to skip the c_main business.
>
> See 8.2.1.1 here:
> http://www.haskell.org/ghc/docs/7.4.1/html/users_guide/ffi-ghc.html
>
> There's a great chapter in Real World Haskell on exporting and
> importing functions to call to and from C/C++:
> http://book.realworldhaskell.org/read/interfacing-with-c-the-ffi.html
>
> For Objective-C, Objective Haskell is an even higher level (and quite
> excellent) project for calling to and from Obj-C and converting its
> standard data types (NSDictionaries, NSStrings, NSData etc.) into
> Haskell's (Maps, Text, ByteStrings etc.), and vice-versa.
> https://github.com/jspahrsummers/ObjectiveHaskell
>
> It uses Template Haskell to make importing and exporting extremely
> easy and clean, but sadly ghc-ios doesn't support TH quite yet. I have
> an experimental branch that replaces the TH with manually-written
> boilerplate but of course it's a lot messier. I'll be publishing it
> soon anyway : ).
>
> Cheers
> Luke
>
> On Sat, Dec 1, 2012 at 1:26 PM, Stephen Paul Weber
> <singpolyma at singpolyma.net> wrote:
> > Somebody claiming to be Casey Basichis wrote:
> >>
> >> Is the FFI the right tool for a situation where, while used extensively,
> >> Haskell is more or less there to take in data, like lists and spit out
> >> data
> >> like vectors etc back to C.
> >
> >
> > My current favourite way to do this is to start in Haskell-land and call
> > some entry-point function in extern "C" that takes function pointers as
> > arguments.  These function pointers become the way that C++ code can call
> > back into Haskell-land.
> >
> > This is what I am using for <http://github.com/singpolyma/haskades>
> >
> > --
> > Stephen Paul Weber, @singpolyma
> > See <http://singpolyma.net> for how I prefer to be contacted
> > edition right joseph
> >
> >
> > _______________________________________________
> > iPhone mailing list
> > iPhone at haskell.org
> > http://www.haskell.org/mailman/listinfo/iphone
>
> _______________________________________________
> iPhone mailing list
> iPhone at haskell.org
> http://www.haskell.org/mailman/listinfo/iphone
>



-- 
Telegram, Simply Beautiful CMS https://telegr.am
Lift, the simply functional web framework http://liftweb.net
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/iphone/attachments/20121201/93b46d69/attachment-0001.htm>


More information about the iPhone mailing list