Skip to content

addCStub doesn't allow control over compiler flags or source file file

Currently if you pass a C source file on the GHC command line you can control whether the compiler treats it as C or C++ via the it's extension: GCC will treat a file ending in .c as C, whereas .cpp is treated as C++.

However, we currently have no means of controlling what language a stub added with in Template Haskell with addCStub will be treated as. Consequently it is currently impossible to compile a C++ source file with addCStub without using -optc. Moreover, you can't have mixed C/C++ stubs at all.

It really seems like this interface should be amended to fix this before we release it in 8.2. Perhaps addCStub should accept both the source and a set of compiler flags which will be added to the usual flags (allowing one to pass -x c++ to the compiler when compiling C++ files)?

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority high
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC facundo.dominguez, mboes
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information