Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A dynamic link library (DLL) initialization routine failed. #12

Closed
ComedicChimera opened this issue Mar 21, 2018 · 3 comments
Closed

A dynamic link library (DLL) initialization routine failed. #12

ComedicChimera opened this issue Mar 21, 2018 · 3 comments

Comments

@ComedicChimera
Copy link

ComedicChimera commented Mar 21, 2018

I am trying to use naudiodon to stream audio in an Electron.js application. When I attempt to use naudiodon, I get a series of errors related to a dll not being able to be initialized.

Here is my calling code:

const portAudio = require('naudiodon');

// get a list of devices
module.exports.getDeviceList = () => {
  let deviceNames = {};
  for(var x of portAudio.getDevices()) {
    if (x.maxOutputChannels > 0) {
      deviceNames[x] = x.id;
    }
  }
  return deviceNames;
}

The code in my Electron.js html page:

let deviceList = Object.keys(api.getDeviceList());
let optionsHtml = '';
for(var x of deviceList) {
     optionsHtml += `<option>${x}</option>`;
 }
 $('#device').html(optionsHtml);

With api being a reference to the first bit of code.

The traceback:

Error: A dynamic link library (DLL) initialization routine failed.
\\?\C:\--\node_modules\naudiodon\build\Release\naudiodon.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 bindings (C:\--\node_modules\bindings\bindings.js:81:44)
    at Object.<anonymous> 
(C:\--\node_modules\naudiodon\index.js:19:46)
    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 bindings (C:\--\node_modules\bindings\bindings.js:81:44)
    at Object.<anonymous> (C:\--\node_modules\naudiodon\index.js:19:46)
    at Object.exception
...

Part following the ellipsis appear to be irrelevant. (the error echoing up through my code)

I installed naudiodon with npm install naudiodon --save.
I am using the following version of npm and nodejs:
Nodejs: v8.10.0
npm: v5.6.0

And the module (naudiodon) version is: 0.4.6

I am on Windows 10 (64 bit OS)

Please reply as soon as possible. Thanks!

@scriptorian
Copy link

There are two dlls associated with naudiodon that will need to be loaded - naudiodon.node (a dll really) and portaudio_x64.dll. You are 'require'ing one which will try to pull in the other. It isn't clear to me from your log whether one or both is not being found. Just a couple of thoughts:

  1. Have you tried your JS code without electron ?

  2. Depending on your configuration, electron has a bundle step that may need some configuration to be told to build naudiodon correctly and include the portaudio binary. A quick search yielded: https://electronjs.org/docs/tutorial/application-packaging & https://stackoverflow.com/questions/38361996/how-can-i-bundle-a-precompiled-binary-with-electron

Good luck!

@NahanaBanahnah
Copy link

I had this issue with this as well as some other packages. Installing native modules fixed it for me

npm install --save-dev electron-rebuild

# Every time you run "npm install", run this
./node_modules/.bin/electron-rebuild

# On Windows if you have trouble, try:
.\node_modules\.bin\electron-rebuild.cmd

https://github.com/electron/electron/blob/v0.37.2/docs/tutorial/using-native-node-modules.md#using-native-node-modules

@scriptorian
Copy link

Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants