// JavaScript (UTF-8) UTF-16 function TEXT(text){ return new Buffer(text, 'ucs2').toString('binary'); } var FFI = require('node-ffi'); // user32.dll var user32 = new FFI.Library('user32', { 'MessageBoxW': [ 'int32', [ 'int32', 'string', 'string', 'int32' ] ] }); // var OK_or_Cancel = user32.MessageBoxW( 0, TEXT(', !'), TEXT(' '), 1 );
At present, the future of Node.js is not yet radiant enough, since onlyAnd a month has not passed, as the second of these three points was realized. Any library can be scripted by javascripts. Accordingly, applications on Node.js for Windows have become available to all the power of the system API , and cross-platform applications can apply to cross-platform libraries indiscriminately, dragging them with them.≈1½ months ago this engine exists not only under Linux, under Mac and under Solarium, but also under Windows.
You should expect a powerful synergistic impulse at the moment when the developers of JavaScript who have Windows on their work computer will also start writing the code for Node.js modules. According to my estimates, it’s not enough to port only the Node.js engine itself to Windows; It will also take at least this:
- Smooth operation of the npm package manager. In particular, the appearance of the possibility for developers to deliver pre-compiled modules for win32 and win64 will be extremely useful: you cannot rely on the fact that each end-user has development tools (for example, Visual Studio 2010 Express). It is clear that the developers of the modules should take up their wits, or even the npm install zip command cannot be submitted under Windows without stumbling on the symlink inside the tarball. (Or the author of the npm / lib / utils / tar.js script could better provide for this.)
- The emergence of the ability to scramble an arbitrary system library. (It will probably appear after porting node-ffi to Windows.) It is only from here that the path to the creation of the GUI will stretch.
- Appearance of the opportunity to work with the database file (and not client-server) type. (It will probably appear after porting node-sqlite3 to Windows.)
compiled/darwin/x64/ffi_bindings.node compiled/linux/ia32/ffi_bindings.node compiled/linux/x64/ffi_bindings.node compiled/sunos/ia32/ffi_bindings.node compiled/win32/ia32/ffi_bindings.node
and the script lib / bindings.js during the call to the var join = require('path').join , bindings = 'ffi_bindings.node' function requireTry () { var i = 0 , l = arguments.length , n for (; i<l; i++) { n = arguments[i] try { var b = require(n) b.path = n return b } catch (e) { if (!/not find/i.test(e.message)) { throw e } } } throw new Error('Could not load the bindings file. Tried:\n' + [].slice.call(arguments).map(function (a) { return ' - ' + a }).join('\n')) } module.exports = requireTry( // Production "Release" buildtype binary join(__dirname, '..', 'compiled', process.platform, process.arch, bindings) // Release files, but manually compiled , join(__dirname, '..', 'out', 'Release', bindings) // Unix , join(__dirname, '..', 'Release', bindings) // Windows // Debug files, for development , join(__dirname, '..', 'out', 'Debug', bindings) // Unix , join(__dirname, '..', 'Debug', bindings) // Windows )
Source: https://habr.com/ru/post/136185/
All Articles