[Haskell-cafe] Calling Haskell from C, Linking with gcc?

Thomas DuBuisson thomas.dubuisson at gmail.com
Tue Oct 6 12:48:44 EDT 2009

Generally you should be able to tell which library you're missing
based on the names of the undefined symbols.  Have you link in...
libgmp.a? libm.a? libc.a?  What are the missing symbols?


On Tue, Oct 6, 2009 at 9:44 AM, John Velman <velman at cox.net> wrote:
> I think if I knew which libraries to add to the gcc link, I could make this
> work, but can't seem to find out from the documentation.
> Here are more specifics:
> I'd like to build a Cocoa  program on OS X with the Aqua user interface
> using Xcode, but using a Haskell module with functions accessed through the
> foreign export  interface.  In fact this seems to fit in well with the
> Apple Model-View-Control programming pattern, with Haskell implementation
> of the Model, maybe some of the Control,  and Cocoa implementation of the
> View and some of the Control.
> I've put together a short program (from the Wiki calling Haskell from C
> example) and compiling and linking with ghc it runs as advertised.
> As an experiment, I put the c main program into an Xcode project, added the
> haskell module .o and stub.o, stub.h files.  Also added the HsFFI.h.  Then
> did a build and run.  As expected I got a bunch of missing entry points
> (26, if I recall correctly).  Adding libffi.a and libHSrts.a brings me up
> to 56 missing entry points. Searching the other lib files for these seems
> pretty hopeless.
> Any pointers to documentation, or other help will be greatly appreciated!
> Thanks,
> John Velman
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list