Ticket #4115 (closed bug: fixed)
hsc2hs puts linker flags before object file, causes linker errors
|Reported by:||guest||Owned by:|
|Type of failure:||Other||Difficulty:|
|Test Case:||Blocked By:|
I'm trying to write a Haskell wrapper for a C library (called unibilium) using hsc2hs. In one of my files I have custom macros that reference functions from the C library (and #include "unibilium.h").
When I run hsc2hs -I.. foo.hsc, I get linker errors for those functions, as expected. However:
% hsc2hs -I.. foo.hsc -L-L.. -L-lunibilium foo_hsc_make.o: In function `main': foo_hsc_make.c:(.text+0x1a0): undefined reference to `unibi_name_bool' foo_hsc_make.c:(.text+0x23b): undefined reference to `unibi_name_bool' collect2: ld returned 1 exit status linking foo_hsc_make.o failed command was: gcc -L.. -lunibilium foo_hsc_make.o -o foo_hsc_make
Same error. This is because hsc2hs calls gcc with the -l option before the filename, at which point there are no unresolved references, so the library is simply discarded.
hsc2hs should leave my linker options where I put them, at the end of the command line.