Reputation: 681
I wanted to call one exported function in a Dll written using C Language from my chrome extensions. But not getting sufficient info on how to do that.
In Firefox I am using below mention code in my extensions js file to do so, but same is not working in chrome.
var InstallPath="C:\\FRViewPortExtn.dll";
Components.utils.import("resource://gre/modules/ctypes.jsm");
var lib = ctypes.open(InstallPath);
/* Declare the signature of the function we are going to call */
passBrowserResizeData = lib.declare("SetViewPort",
ctypes.winapi_abi,
ctypes.void_t,
ctypes.int32_t,
ctypes.float32_t,
ctypes.int32_t,
ctypes.int32_t);
and calling using
passBrowserResizeData(6,7,8,9);
Please help me on how it can be done using chrome exteniosns
Upvotes: 1
Views: 3081
Reputation: 18534
Place FRViewPortExtn.dll relative to manifest file and add the following code to manifest.json
"plugins": [
{ "path": "FRViewPortExtn.dll", "public": true },
],
Put this piece of code in your JS(content js\background js\extension js)
var plugin = document.getElementById("pluginId");
var result = plugin.passBrowserResizeData(6,7,8,9); // call a method in your plugin
For more information refer https://developer.chrome.com/extensions/npapi.html
Upvotes: 1