[Haskell-iPhone] FFI for living in C

Robert Lorentz robert.lorentz at me.com
Sat Dec 1 18:40:43 CET 2012


Casey -

Yep your use case is a good one. It's my approach too and this set up should achieve it

The confusion about which loads up first --

The Haskell .a must have a main(). So it must be the entry point. So it must start first. It then launches the objc's "c_main" so that normal control/flow can occur. 

Then you simply call your Haskell code whenever you want and essentially you can just sleep the haskell's main forever

Hope this helps -- don't think I'm an expert, I just happen to have the identical questions as you and I started 2 days before you :)

On Dec 1, 2012, at 12:28 PM, Casey Basichis <caseybasichis at gmail.com> wrote:

> Hi,
> 
> I've been reading about the FFI for getting Haskell to communicate with C code (C++ really).
> 
> My intention is to handle most of the app - the GUI events in C++ and sending all of the processing logic in Haskell - including a database etc.
> 
> 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.
> 
> I am looking to get a few test running where I can pass data in an out  of Haskell like vectors of floats.
> 
> Also, I noticed on the wiki example:
> 
> Haskell start
> c_main
> I was a little confused by this.  Does Haskell load up first because its a library?  I couldn't figure out where it was being called in the C code or why Haskell loads first.  Not a biggie just a bit of an impediment in understanding how it all works.
> 
> Thanks,
> Casey
> 
> 
> -- 
> Casey James Basichis
> Composer - Cartoon Network
> http://www.caseyjamesbasichis.com
> caseybasichis at gmail.com
> 310.387.7540
> _______________________________________________
> iPhone mailing list
> iPhone at haskell.org
> http://www.haskell.org/mailman/listinfo/iphone
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/iphone/attachments/20121201/1b14130d/attachment.htm>


More information about the iPhone mailing list