
jeff p wrote:
In case anyone else finds this useful...
My linking problem was finally resolved by using the -fvia-C flag when compiling with ghc.
Thanks to Stefan O'Rear who pointed out the possibility and wrote:
Does using -fvia-C help at all? The C compiler understands header files and is sometimes better equipped to resolve things.
If -fvia-C fixes your problem, then your code has a bug, strictly speaking. If your foreign call requires some information from a header file, then the right way to call it is by making a small C wrapper function and calling that. Bear in mind that we'll be deprecating -fvia-C in the future, and also that you might want your code to work in GHCi too, which doesn't read any header files when compiling foreign imports. Cheers, Simon