Talk:FFI complete examples: Difference between revisions
(New page: 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 Ha...) |
(wiki syntax) |
||
Line 7: | Line 7: | ||
[https://github.com/mcandre/hscharm] | [https://github.com/mcandre/hscharm] | ||
$ make | |||
$ make | cp /usr/include/charm.c . | ||
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 | ||
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 ) | ||
[1 of 2] Compiling Charm ( charm.hs, charm.o ) | [2 of 2] Compiling Main ( hellocharm.hs, hellocharm.o ) | ||
[2 of 2] Compiling Main ( hellocharm.hs, hellocharm.o ) | Linking hellocharm ... | ||
Linking hellocharm ... | ld: duplicate symbol _Charm_getWidth_info in charm.o and charm.o | ||
ld: duplicate symbol _Charm_getWidth_info in charm.o and charm.o | collect2: ld returned 1 exit status | ||
collect2: ld returned 1 exit status | make: *** [hellocharm] Error 1 | ||
make: *** [hellocharm] Error 1 | |||
Revision as of 06:50, 14 July 2011
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.
charm [1]
hscharm [2]
$ 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 1