Building Electron Native Extensions using Visual Basic 2015

时间:2016-08-31 12:06:01

标签: node.js visual-studio electron

Where I am currently:

I have began working on a NodeJS native extension I intend to work with Electron, but from previous works I have noted that the build steps for building for just NodeJS are as expected, include the libraries as per instruction and change to output a .dll file with a .node extension.

The problem I am facing:

When compiling my extension, which tried and tested within NodeJS, does not work within an Electron contained instance of NodeJS - from searching around I understand this to be a problem with the header files which I am compiling against etc. The documentation for building with visual studio (not Visual Studio Code) is very sparse and everywhere generally points to using node-gyp - which is something I'm attempting to avoid and build using purely Visual Studio 2015.

For reference, when running the working (in NodeJS) NativeExtension I get the following error (which googling brought me to the conclusion I am compiling against the wrong thing):

ELECTRON_ASAR.js:167 Uncaught Error: Module did not self-register.

Could someone please shed some light on where I may be going wrong? I am a novice when it comes to C++ program structure and compiling methodologies.

1 个答案:

答案 0 :(得分:1)

  

使用visual studio(不是Visual Studio Code)构建的文档非常稀疏,并且通常指向使用node-gyp - 这是我试图使用纯Visual Studio 2015来避免和构建的。

有一种标准的编译本机Node模块的方法,作为一个自我承认的新手,偏离它是不明智的。我建议您仔细阅读Microsoft NodeJS guidelines并正确配置您的开发环境,以便通过node-gyp进行构建,一旦工作,您就可以开始计算how to rebuild native Node modules for Electron