hsc2hs and c2hs are good suggestions, and some of the tutorials I&#39;m following use them.<div><br></div><div>But 1) Many Haskell FFI tutorials don&#39;t require them, so they only seem to help, or only help in older versions of GHC.</div>

<div><br></div><div>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:</div><div><br></div><div>ld: duplicate symbol _Charm_getWidth_info in charm.o and charm.o<br clear="all">

<div><br></div>Cheers,<div><br></div><div>Andrew Pennebaker</div><div><a href="http://www.yellosoft.us" target="_blank">www.yellosoft.us</a></div>
<br><div class="gmail_quote">On Sat, Apr 9, 2011 at 9:50 PM, Jason Dagit <span dir="ltr">&lt;<a href="mailto:dagitj@gmail.com">dagitj@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<p>I don&#39;t know how to make ghc load them without using either hsc2hs or c2hs. I&#39;ve had better experiences with hsc, but your mileage may vary.</p>
<p></p><blockquote type="cite"><div><div></div><div class="h5">On Apr 8, 2011 3:34 AM, &quot;Andrew Pennebaker&quot; &lt;<a href="mailto:andrew.pennebaker@gmail.com" target="_blank">andrew.pennebaker@gmail.com</a>&gt; wrote:<br>

<br>ncurses is proving too difficult to setup, so I&#39;m working on a new library called charm. The C code works by itself, but I can&#39;t compile a Haskell wrapper for it. While the tutorials at <a href="http://www.haskell.org/haskellwiki/FFI_complete_examples" target="_blank">HaskellWiki</a> are helpful, they&#39;re outdated. Argh! The <a href="http://www.haskell.org/ghc/docs/latest/html/users_guide/ffi-ghc.html#glasgow-foreign-headers" target="_blank">docs</a> 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.<br>




<br>GitHub: <a href="https://github.com/mcandre/charm" target="_blank">charm</a> and <a href="https://github.com/mcandre/hscharm" target="_blank">hscharm</a><br><br><a href="https://github.com/mcandre/charm" target="_blank"></a>$ make<br>


cp /usr/include/charm.c .<br>ghc --make -fforce-recomp -o hellocharm hellocharm.hs charm.hs charm.c -I/usr/include -dylib-install-name /usr/lib/libcharm.dynlib<br>

[1 of 2] Compiling Charm            ( charm.hs, charm.o )<br>[2 of 2] Compiling Main             ( hellocharm.hs, hellocharm.o )<br>Linking hellocharm ...<br>ld: duplicate symbol _Charm_getWidth_info in charm.o and charm.o<br>




collect2: ld returned 1 exit status<br>make: *** [hellocharm] Error 1<br clear="all"><div><br></div>Cheers,<div><br></div><font color="#888888"><div>Andrew Pennebaker</div><div><a href="http://www.yellosoft.us" target="_blank">www.yellosoft.us</a></div>





</font><br></div></div>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote><p></p>
</blockquote></div><br></div>