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

Gregory Collins greg at gregorycollins.net
Tue Oct 6 15:07:01 EDT 2009

John Velman <velman at cox.net> writes:

> On Tue, Oct 06, 2009 at 09:48:44AM -0700, Thomas DuBuisson wrote:
> Thanks, Thomas.
> Linking in only libffi.a, libgmp.a, I get (for example, there are many
> more) missing:
>   "_newCAF"  
>   "_base_GHCziBase_plusInt_closure"
>   "_base_GHCziList_zzipWith_info"
>   "_base_GHCziList_lvl5_closure"
> by also linking in libHSrts.a, I no longer am missing _newCAF, (and others
> that were missing without it) but am missing a lot of _base_GHCzi...
> references.  I've been unable to track these down.
> By the way, I can't find either a libc.a or libm.a on this machine using
> either locate or spotlight.
> Is there a way to "guess" which library things are in, short of doing 
> an nm with some appropriate option on each .a file in the Haskell lib?

    $ cd /Library/Frameworks/GHC.framework/Versions/Current/usr/lib/
    $ for i in `find . -name '*.a'`; do nm -a $i 2>/dev/null | grep --label="$i" -H 'D *_base_GHCziBase_plusInt_closure'; done
    ./ghc-6.10.4/base- D _base_GHCziBase_plusInt_closure
    ./ghc-6.10.4/base- D _base_GHCziBase_plusInt_closure

Gregory Collins <greg at gregorycollins.net>

More information about the Haskell-Cafe mailing list