Well there is
const
NimCompilerApiVersion* = 3 ## Check for the existance of this before accessing it
## as older versions of the compiler API do not
## declare this.
in compiler/nversion.nim
Do you think it is feasible?
probably not. what would likely be needed is that nim would expose a nim api/abi to nlvm, much like if you had wrapped a c++ library with a c api.. that would require a lot of changes to nim, including specifying an ABI etc.
header pragmas for C stuff are kind of not needed if you take care to correctly specify the ABI (correct function signatures / types) - that's how nlvm is able to use the nim std lib which is full of references to the C std library. In fact, nim itself doesn't really need header if you write things correctly. Of course, for C++ that's nearly impossible.