使用Visual Basic 2015构建电子本机扩展 [英] Building Electron Native Extensions using Visual Basic 2015
问题描述
我已经开始研究打算与Electron一起使用的NodeJS本机扩展,但是从以前的工作中我已经注意到构建步骤如预期的那样,仅用于NodeJS的构建,请按照说明包括库,并进行更改以输出带有.node扩展名的.dll文件。
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.
在编译我在NodeJS中尝试并测试过的扩展程序时,在Node.js的Electron包含实例中无法正常工作-通过搜索,我知道这是一个问题我正在针对之进行编译的头文件等。使用Visual Studio构建的文档(非Visual Studio代码)非常稀疏,到处通常都指向使用node-gyp-这是我正在尝试的东西避免并纯粹使用Visual Studio 2015进行构建。
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.
作为参考,在运行有效的(在NodeJS中)NativeExtension时,出现以下错误(其中g oogling得出的结论是我正在针对错误的内容进行编译):
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.
有人可以告诉我我可能要去哪里了吗?对于C ++程序结构和编译方法,我是一个新手。
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.
推荐答案
使用Visual Studio(而不是Visual Studio Code)进行构建非常稀疏,到处通常都指向使用node-gyp,这是我要避免的事情,而我纯粹是使用Visual Studio 2015进行构建。
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.
有一种编译本机Node模块的标准方法,作为一个自学成才的新手,偏离它是不明智的。我建议您通读 Microsoft NodeJS指南,并正确配置您的开发环境以通过 node-gyp
进行构建,一旦可行,您就可以开始研究如何为Electron重建本机节点模块。
There is a standard way of compiling native Node modules, and as a self admitted novice it would be unwise to deviate from it. I suggest you read through the Microsoft NodeJS guidelines and get your development environment properly configured to build via node-gyp
, once that's working you can start figuring out how to rebuild native Node modules for Electron.
这篇关于使用Visual Basic 2015构建电子本机扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!