FIXED IT!!!
hsc2hs and c2hs are good suggestions, and some of the tutorials I'm following use them.But 1) Many Haskell FFI tutorials don't require them, so they only seem to help, or only help in older versions of GHC.And 2) When I did compile using c2hs, it just produced the same file, but with filler comments like {#- LINE 13 #-}. And they still refused to compile for the same reason:ld: duplicate symbol _Charm_getWidth_info in charm.o and charm.o
On Sat, Apr 9, 2011 at 9:50 PM, Jason Dagit <dagitj@gmail.com> wrote:
I don't know how to make ghc load them without using either hsc2hs or c2hs. I've had better experiences with hsc, but your mileage may vary.
_______________________________________________On Apr 8, 2011 3:34 AM, "Andrew Pennebaker" <andrew.pennebaker@gmail.com> wrote:
ncurses is proving too difficult to setup, so I'm working on a new library called charm. The C code works by itself, but I can't compile a Haskell wrapper for it. While the tutorials at HaskellWiki are helpful, they're outdated. Argh! The docs say that -#include pragmas no longer work, but fail to explain how to load code without them. Suffice to say I have no recourse but trial and error.
GitHub: charm and hscharm
$ make
cp /usr/include/charm.c .
ghc --make -fforce-recomp -o hellocharm hellocharm.hs charm.hs charm.c -I/usr/include -dylib-install-name /usr/lib/libcharm.dynlib
[1 of 2] Compiling Charm ( charm.hs, charm.o )
[2 of 2] Compiling Main ( hellocharm.hs, hellocharm.o )
Linking hellocharm ...
ld: duplicate symbol _Charm_getWidth_info in charm.o and charm.o
collect2: ld returned 1 exit status
make: *** [hellocharm] Error 1Cheers,Andrew Pennebaker
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe