How to call local .dll files in Electron App

白昼怎懂夜的黑 提交于 2019-12-03 08:17:20

问题


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


回答1:


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



回答2:


Electron-Edge helps to run .NET in Node.js on Electron.
You can find it on GitHub.
Here it is explained how to use dll files in it.(Scroll Down a little to find 'If you prefer to pre-compile your C# sources to a CLR assembly you can reference a CLR assembly from your Node.js code...'



来源:https://stackoverflow.com/questions/39567446/how-to-call-local-dll-files-in-electron-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!