简体   繁体   中英

Compiler version issue for Node.js C++ addon development

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.

  1. How do we know which C++ compiler is used for the pre-build Node.js distribution on my machine (Mac, Windows or Linux)?

  2. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM