Skip to content

Commit 22ad175

Browse files
committed
rebased and minor updates
1 parent 04f6053 commit 22ad175

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

building-for-cross-platform.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1-
## Writing cross-platform apps
1+
## Writing cross-platform modules and apps
22
* http://shapeshed.com/writing-cross-platform-node/
33
* https://gist.github.com/domenic/2790533
4+
5+
## Accessing platform APIs
6+
Sometimes you need to access plaform functionality for which no suitable module is available. For example your product may need to access the registry running on a Windows Server or Desktop. In this case there are 2 ways to proceed.
7+
8+
1. Create a native module add-on by wrapping code in C binding boilerplate code [using the V8 sdk and dev tools](https://nodejs.org/api/addons.html).
9+
2. Use [ref](https://github.com/TooTallNate/ref) and [node-ffi](https://github.com/node-ffi/node-ffi) modules to access C buffers and call shared library (DLL) functions from javascript.
10+
11+
There are plenty of examples of [creating native modules](http://www.martinchristen.ch/node/tutorial11) incuding our notes on [Compiling native addon modules](windows-environment.md#compiling-native-addon-modules)but not so much on [of node-ffi](http://opendirective.net/blog/2015/10/working-with-windows-native-code-from-node-js)
12+
13+
> :bulb: Note it is good practice to ensure published modules work on all platforms as discussed above, even though this can be conciderable work. While there are no doubt exceptions, such accessing the Windows registry, modules that only work on Windows or Linux are likely to unpopular.
14+

windows-environment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ For additional discussion, please see https://github.com/Microsoft/nodejstools/i
4646

4747
### Compiling native addon modules
4848
There are three primary reasons you might be interested in this section:
49-
* you have an existing C++ libary you'd like to take advantage of in your Node.js application
49+
* you have an existing C++ library you'd like to take advantage of in your Node.js application
5050
* you are interested in optimizing the performance of some code by writing it in C++
5151
* you're running into dreaded `node-gyp` issues and have no idea what's going on.
5252

0 commit comments

Comments
 (0)