I am trying to access some exported functions from a MSVS 2013 C/C++ DLL via FireFox's js-ctypes. I have tried :
- Changing the "Compile As" settings to C and C++
- Changing the platform bitness (32 vs 64 bits).
- Using ALL the available ABI constants from here: https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes/js-ctypes_reference/ctypes (
default_abi
,stdcall_abi
,winapi_abi
) - I have checked my DLL using "Dependency Walker" and made sure that its name was not decorated and that my function was indeed exported.
Here is my DLL code:
#define DllExport extern "C" __declspec(dllexport)
DllExport void Test()
{
::MessageBox(NULL, _T("Test!"), _T("Title"), MB_OK);
}
No matter what I try, it seems that I always get this error:
console.error: myxpi:
Message: Error: couldn't find function symbol in library
Stack:
openScratchpad@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///c:/users/kgk/appdata/local/temp/tmpdyrqfd.mozrunner/
extensions/jid1-QEiY1nT1Uinqug@jetpack.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://jid1-qeiy1nt1uinqug-at-jetpack/myxpi/lib/main.js:34:18
button<.onClick@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///c:/users/kgk/appdata/local/temp/tmpdyrqfd.mozrunner/extensions/jid1-QEiY1nT1Uinqug@jetpack.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://jid1-qeiy1nt1uinqug-at-jetpack/myxpi/lib/main.js:16:9
Does anyone have any idea what are the proper settings?
FF is 32 bits (as far as I know) but I don't know if it uses something else like python to load the DLL.
I thought that the "Compile As" wouldn't matter as long as the exporting functions used the proper declaration (e.g. __cdecl
).
I am not sure what this produces though (but my project settings are for __cdecl
):
#define DllExport extern "C" __declspec(dllexport)
But I have tried replacing that too and using DEF files...
Any idea why nothing seems to wok?
Related questions:
Making a C DLL in Visual Studio suitable for use by js-ctypes in Mozilla
Build a DLL to be used by Mozilla js-ctypes