Ticket #7405 (closed bug: wontfix)
use of -no-hs-main causes TH compiles to fail
|Reported by:||MtnViewMark||Owned by:|
|Operating System:||MacOS X||Architecture:||x86|
|Type of failure:||None/Unknown||Difficulty:||Unknown|
|Test Case:||Blocked By:|
If you compile a project with -no-hs-main, so that you can (for example) have a c based main that runs first, then you can't use template haskell, as during compilation, the template haskell code fails to link and run.
What appears to happen is that the .c file with the "real main" gets loaded (in order to have a main), but it fails to find the function it will call as it is (directly, or transitively) dependent on the very template haskell enabled .hs file being compiled.
The attached tar ball is a simple cabal based project that builds three executables:
- plain-main - plain HS main, using a TH value
- c-no-th-main - c based main, calling into a HS function, no TH
- c-main - c based main, calling into a HS function that uses TH
The c-main program will fail to build, while the other two work (demonstrating that the TH code is reasonable, and that the c main function is reasonable.)