Developing a Firefox addon, using ctypes to load a custom DLL - On my real computer (win 7/64) the DLL loads without a hitch, but inside my test VM using the same OS, the following error occurs:
console.error: bzaddon:
Message: Error: couldn't open library .\BZAddOnHelper.dll: error 126
Stack:
@resource://bzaddon/index.js:25:11
run@resource://gre/modules/commonjs/sdk/addon/runner.js:145:19
startup/</<@resource://gre/modules/commonjs/sdk/addon/runner.js:86:7
Handler.prototype.process@resource://gre/modules/Promise-backend.js:867:23
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise-backend.js:746:7
this.PromiseWalker.scheduleWalkerLoop/<@resource://gre/modules/Promise-backend.j
s:688:37
The code to load the library:
// Get the chrome components
let { Ci, Cu, Cr } = require('chrome');
// Get ctypes
Cu.import("resource://gre/modules/ctypes.jsm");
// External DLL
var lib = ctypes.open(".\\BZAddonHelper.dll");
I even tried with a completely empty DLL, that does NOT depend on msvc*:
screenshot of 'depends' on the target vm
I tried using moving the DLL to the data directory and using self.data.url and using no path at all. I tried using a complete path. the ONLY thing that works is copying my DLL to SysWow64 (The DLL is 32bit, as firefox is 32bit). Again, running this on MY (dev) machine works with ".\dllname" - but not on any other computer... I am at a complete and utter loss... Anyone?
You should not have to install to system32, see this working addon that uses custom dll: github.com/NoitForks/Firefox_addon_sdk_jsctypes and this one: github.com/NoitForks/fx-sapi-test Im certain your mistake is you are not using a string that is using file:// protocol. If its at C:\blah.dll do ctypes.open('file://C:/blah.dll')