I need assistance with developing a Firefox extension that requires calling native C code.
Here is my C program code:
#include<windows.h>
int add(int a, int b)
{
return(a + b);
}
And here is my JavaScript code:
var {Cu} = require('chrome');
var self = require('sdk/self');
Cu.import("resource://gre/modules/ctypes.jsm");
var lib;
var puts;
lib = ctypes.open('G:\\Shankar\\Project\\Maidsafe\\Firefox\\addon-sdk-1.17\\jsctype_sample\\data\\Win32Project1.dll');
try {
puts = lib.declare("add", /* function name */
ctypes.default_abi, /* call ABI */
ctypes.int32_t, /* return type */
ctypes.int32_t, /* argument type */
ctypes.int32_t /* argument type */
);
} catch (e) {
console.log('Error: '+ e);
}
function binaryFile() {
var ret = puts(1, 2);
dump(ret);
lib.close();
};
exports.binaryFile = binaryFile;
Upon calling the binaryFile
function, I encounter the error:
Couldn't find function symbol in library
I would appreciate any assistance. Thank you.