本文介绍了如何在Electron App中调用本地.dll文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在如何将示例.dll文件调用到我的Electron App中时遇到问题。我的文件夹中有示例.dll文件,问题是如何访问我的sample.dll文件以及如何调用我的sample.dll函数并获取结果。任何要遵循的教程或步骤,请启动示例代码

i have an issue how to call sample .dll files into my Electron App. I have sample .dll files in my folder, the thing is how to access my sample.dll file and how to call my sample.dll function and gets results. Any tutorials or steps to follow please sample code to start

推荐答案

调用 .dll 与在普通NodeJS中调用一个没什么不同,这意味着您有两个选择,或。

Calling into a .dll in Electron is no different to calling into one in plain NodeJS, which means you have two options, node-ffi or a native Node addon that links with your .dll and exposes a JavaScript API. If you decide to create a native Node addon you will need to build it to target Electron.

以下是涉及这些主题的链接:

Here are some links that cover these topics:







  • node-ffi vs. node extension for accessing existing C++ functionality
  • Call C++ library from Node.js (Node addons / node-ffi)
  • https://github.com/node-ffi/node-ffi/wiki/Node-FFI-Tutorial
  • https://blog.scottfrees.com/calling-native-c-dlls-from-a-node-js-web-app
  • http://blog.scottfrees.com/building-an-asynchronous-c-addon-for-node-js-using-nan

这篇关于如何在Electron App中调用本地.dll文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 17:06