Hey!
@Jimb Esser
The answer to the simple question you pose would only be useful if I were to
1. package the code which is sensitive to the -DDEBUG flag in a separate module (call it c-code) with its own package.json and everything, built in release mode, and
2. place the C++ bindings in a second module (call it cpp-code) which depends on c-code and is being built in debug mode.
This kind of setup feels unusual to me, because c-code would have absolutely no JS bindings, so the main.js or index.js or whatever I specify as the entry point of the package would do absolutely nothing. Nevertheless, if this is the structure things need to have for me to be able to test the native side of my C++ bindings, then so be it, and please, someone, let us know if it's possible to build a package in debug mode without building its entire dependency tree in debug mode as well.
The current setup is such that the C code which is sensitive to -DDEBUG is in the same package as the C++ code which provides node bindings to the C code. My original motivation for looking into debug mode was that I wanted to add instrumentation to my C++ bindings which compile conditionally on the presence of -DDEBUG or -D_DEBUG so that I may write tests in JS which would test the native side of my package. However, it looks like I'll have to come up with my own testing workflow because there's absolutely no documentation anywhere about how to affect node's debug mode CFLAGS and/or DEFINES via binding.gyp and/or config.gypi, and it also sounds like debug mode is a recipe for instability.
So, if somebody can please point me to some documentation about how to prevent node-gyp from passing -DDEBUG to the compiler when building in debug mode, then I would greatly appreciate that, because I would like to draw my own conclusions about the usefulness of debug mode given that my package has only one native dependency (ffi). In the meantime, I'll try to come up with an alternative workflow for debugging and testing my native code.
Thanks for all your help so far!
Gabriel