UPDATE
- PROJECT HAS MOVED TO: http://code.google.com/p/jslibs
jsni is now a module of the Jslibs project and has been renamed jsffi (JavaScript Foreign Function Interface). see http://code.google.com/p/jslibs/wiki/jsffi
JSNI for JavaScript Native Interface is a project that will allow you to call any symbol in a native module (dll/so). This project is a simple file that you can link with any spidermonkey embedding project.
Example:
function MyAlert( text, caption ) {
var ret = new NativeData;
ret.PU32.Alloc();
new NativeModule( 'C:\\WINDOWS\\SYSTEM32\\User32').Proc('MessageBoxA')( ret.PU32, DWORD( 0 ), SZ(text), SZ( caption || 'Alert' ), DWORD( 1 ) );
return ret.PU32[0];
}
MyAlert('Hello World.', 'message');