[Haskell-cafe] Calling Haskell from C, Linking with gcc?
velman at cox.net
Tue Oct 6 19:20:31 EDT 2009
Thanks, Gregory. I did something like that. In particular, I did
find . -name "lib*.a" | xargs nm > ~/develop/haskellLibInfo/libInfo
Then I used the output from the build results file to look for stuff in the
libInfo file (using mac_vim). In this way I cut the number of undefined
references down to 17 (from 56). The remaining references all seem (from
the nm results) to be in libgmp.a, which I included in the project early
in this experiment. The remaining ones are, for example:
All are of the __gmpz variety.
So far all that I've looked in my libInfo have entries something like:
00000000 T ___gmpz_tdiv_qr
I'm way out of my depth here. Here is a list of files I included in the
HSghc-prim-0.1.0.0.o, HSinteger-0.1.0.1.o, libffi.a, libgmp.a,
libHSbase-220.127.116.11.a, libHSbase-18.104.22.168_p.a, libHSbase-22.214.171.124.a,
I'm using Haskell installed from
haskell-platform-2009.2.0.2-i386.dmg (for OS X).
Well, any further pointers will be highly appreciated.
I'll have to sign off from this today, but hopefully will have more
insights (from self and others) tomorrow.
On Tue, Oct 06, 2009 at 03:07:01PM -0400, Gregory Collins wrote:
> 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-126.96.36.199/libHSbase-188.8.131.52.a:0000008c D _base_GHCziBase_plusInt_closure
> ./ghc-6.10.4/base-184.108.40.206/libHSbase-220.127.116.11_p.a:0000010c D _base_GHCziBase_plusInt_closure
> Gregory Collins <greg at gregorycollins.net>
More information about the Haskell-Cafe