Stijn Sanders
Stijn Sanders

Reputation: 36850

js-ctypes: load a nsISupports from a Windows DLL

Is it possible to use js-ctypes to call a Windows DLL and have it return a nsISupports instance? The Windows DLL does XPCOMGlue, but by not needing NSModule I hope I can improve the registration process. I was hoping there was a ctypes.nsISupports type defined to use as return value, so if it's possible, how do I declare the call?

Upvotes: 1

Views: 202

Answers (1)

David-SkyMesh
David-SkyMesh

Reputation: 5171

From my reading and experimentation, no, it doesn't look like you can. However, you could do the next best thing.

1. Create a win32 DLL exporting plain "C" symbols.

2. Create a "wrapper" XPCom component using JavaScript.

http://kb.mozillazine.org/Implementing_XPCOM_components_in_JavaScript

3. Plumb each plain "C" function exported by the DLL into the JavaScript object.

Possible improvement: create a generic JavaScript shim that does the plumbing automatically.

Upvotes: 1

Related Questions