var runtime = Components.classes["@mozilla.org/xre/app-info;1"] .getService(Components.interfaces.nsIXULRuntime); var abi = runtime.OS + "_" + runtime.XPCOMABI; var lib_name; this.data_loc = ""; //================================================================== // Detect shared library name to load
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cu.import('resource://gre/modules/ctypes.jsm'); | |
var lib = { | |
user32: ctypes.open('user32.dll') | |
} | |
var NULL = ctypes.cast(ctypes.uint64_t(0x0), ctypes.voidptr_t); | |
/* http://msdn.microsoft.com/en-us/library/ms633514%28VS.85%29.aspx | |
* HWND WINAPI GetTopWindow( | |
* __in_opt_ HWND hWnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/types.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <stdio.h> | |
int main() { | |
int fd; | |
struct flock lock, savelock; | |
printf("F_GETLK: %d\n", F_GETLK); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cu.import('resource://gre/modules/ctypes.jsm'); | |
function doit() { | |
try { | |
_x11 = ctypes.open('libX11.so.6'); | |
} catch (e) { | |
try { | |
var libName = ctypes.libraryName('X11'); | |
} catch (e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cu.import('resource://gre/modules/ctypes.jsm'); | |
/* | |
* Alright then, lets start with copy array `a` into `b`, by reusing and modifying `memset`. | |
* Note: memset refered to is found here: http://stackoverflow.com/questions/24466228/memset-has-no-dll-so-how-ctype-it | |
*/ | |
function memcpy(dst, src, size) { | |
for (var i = 0; i < size; ++i) { | |
dst[i] = src[i]; | |
} |