I know that the C++ program is compiler dependent due to the name mangling. So I have the following questions regarding C++ addon for Node.js.
How do we know which C++ compiler is used for the pre-build Node.js distribution on my machine (Mac, Windows or Linux)?
If I know the exact compiler version of the installed Node.js, then I am supposed to use the same compiler to develop C++ addon, right?
Thank you.
Your node add-on's should be distributed as source code in the NPM module. The
npm install
will compile it locally on the machine that will use it, and the machine installing it will decide what version of the compiler will be used.You should not and cannot distribute NPM modules with binary objects the way you state in your question for the exact reason you describe in your question.
Look to use the npm module
nan
to do your C++ add-on.