<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Feb 28, 2015 at 8:20 AM, Thomas Jakway <span dir="ltr"><<a href="mailto:tjakway@nyu.edu" target="_blank">tjakway@nyu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
I'm very new to Haskell and am trying to write a "real" program to
motivate myself to learn it better (so far I've only gotten through
Project Euler problems after reading LYAH and most of RWH). I'm
using Taglib (<a href="https://github.com/taglib/taglib" target="_blank">https://github.com/taglib/taglib</a>) to read the metadata
from a music file and print it. I have a struct C-side (with C
linkage) serving as the bridge between Taglib's C++ and Haskell's
FFI. A small demo program (compiled with gcc and linked against the
C++ object files) gives the correct results, but Haskell is weirdly
only getting <i>some </i>of it right. Specifically, the C string
fields are working but ints are not.<br></div></blockquote><div><br></div><div>The raw FFI is unfriendly, but also not really intended for direct use except in very simple cases. You probably want to look into c2hs (or gtk2hsc2hs which is a fork that supports more complex C headers) to generate the FFI declarations, rather than try to manipulate structs directly.</div><div><br></div></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>brandon s allbery kf8nh sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a> <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div><div>unix, openafs, kerberos, infrastructure, xmonad <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div></div>
</div></div>