When importing headers via the headers pragma, the compiler seems to be evaluating C++ macros. Is there a way to initialize those macros from Nim?
Thanks,
what do you mean by 'initialize'?
the nim compiler produces c/c++ code, {.header:myheader} just adds #import <myheader> to the top of the source file, any c macros in that header file get expanded when the c/c++ preprocessor runs
You can do it like this:
proc x() {.importcpp, header: """#define DEFINEHERE
#include "header.h"
""".}
In some situations this could be useful, too:
{.passC:"-DDEFINEHERE".}