I did following

1. main.c

#include <stdio.h>
int add(int a, int b) {
  return a + b;
}

2. gcc -fPIC -c main.c

3. gcc -shared -o main.so main.o

4. copied main.so file to content folder.

5. started my extension and called on following code in html in the extension

const {utils:Cu} = Components;

alert("loading comp");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/ctypes.jsm");
alert("import done");

const {classes:Ccc} = Components;
try {
        var lib = ctypes.open("chrome://helloworld/content/main.so");
        alert("lib=" + lib);
        var addc = lib.declare("add" , ctypes.default_abi, ctypes.int32_t, 
ctypes.int32_t, ctypes.int32_t);
        alert("addc" + addc(3,4));

}
catch (e) {
        alert(e);
}

I get error that it couldnot open library chrome://helloworld/content/main.so


My manifest file is following

content helloworld      content/
resource helloworld     content/
overlay chrome://browser/content/browser.xul    
chrome://helloworld/content/overlay.xul
locale  helloworld      en-US   locale/en-US/
skin    helloworld      classic/1.0     skin/
style   chrome://global/content/customizeToolbar.xul    
chrome://helloworld/skin/overlay.css

What am i missing.. i put that in components folder also but it didnt help.

How to debug this issue?
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to