[Haskell-cafe] FFI, C/C++ and undefined references

Bulat Ziganshin bulat.ziganshin at gmail.com
Thu Jan 14 15:36:28 EST 2010

Hello DNM,

Thursday, January 14, 2010, 10:42:42 PM, you wrote:

there is better way rather than playing with random bits. just find
tutorial on FFI, and try it. once this example works, start modifying
it to learn various aspects of ffi and add functionality you need

it's one thing i've learned in those 20 years - go forward in small
steps keeping working code instead of jumping at large distance and
then spending days without any clue

> Which is weird, because 'srilm.o'/'srilm.h' are the files that define the
> mysterious "undefined references".  I'll keep plugging away and report
> back when (or whether) I make some progress.  In the meanwhile, if anyone
> has a clue, I'm all ears.

> Best,
> D.N.

> Malcolm Wallace wrote:
>> However, if you are unsure of which Haskell packages are needed, it is  
>> wise to let ghc work out the dependencies for you, e.g. with
>>      ghc --make Main.hs slirm.o
>> It cannot work out the C/C++ dependencies though, so every time you  
>> get "undefined reference" linking errors, you must discover which C  
>> code provides those symbols, and add its object file to the  
>> commandline by hand.

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list