raviSussol / electron-node-ffi

A foreign function interface (FFI) for Electron js, N-API style
MIT License
5 stars 0 forks source link

Uncaught Error: A dynamic link library (DLL) initialization routine failed. #1

Open ravishelke536 opened 2 years ago

ravishelke536 commented 2 years ago

Hi, I am using electron-node-ffi to load windows compiled basic dll . I am getting below error when I run app using npm start using electornJS. Please suggest if i doing something wrong.

var ffi = require('ffi-napi')

var libm = ffi.Library('TestDll.dll', { 'Addition': [ 'int', [ 'int', 'int'] ] }) let result = libm.Addition(10,10)

Uncaught Error: A dynamic link library (DLL) initialization routine failed. \?\C:\Users\Administrator\Desktop\electron-fcm-demo-master\node_modules\ref-napi\prebuilds\win32-x64\electron.napi.node at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:172:20) at Object.Module._extensions..node (module.js:598:18) at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:172:20) at Module.load (module.js:503:32) at tryModuleLoad (module.js:466:12) at Function.Module._load (module.js:458:3) at Module.require (module.js:513:17) at require (internal/module.js:11:18) at load (C:\Users\Administrator\Desktop\electron-fcm-demo-master\node_modules\node-gyp-build\index.js:21:10) at Object. (C:\Users\Administrator\Desktop\electron-fcm-demo-master\node_modules\ref-napi\lib\ref.js:8:53)

hexingcheng commented 2 years ago

Is this problem solved?

raviSussol commented 2 years ago

@ravishelke536 can you post an example repository replicating your issue. Maybe refer: https://github.com/raviSussol/electron-webpack-native-module-example for an example.

@hexingcheng can you also try with above link for a test. See if that helps you to get started.