NaCl, Native Client
The Native Client technology wants to accelerate Web applications at the point of giving them the speed of 3D games, allowing to run software programmed in C or C++ or another language in the browser.
A Web application then can run compiled native code. It is secured like JavaScript. This may allow the browser to be an alternative to the Metro interface in Windows 8.
Native Client, abbreviated NaCl, is supported by Chrome. Firefox supports it through a plugin. Google encourages game developers to make a version for Chrome. The Unity 3D framework already allows to automatically generate a version for the browser.
To make the code more portable, developers are working to interface NaCl with the LLVM compiler which produces intermediate code, in turn compiled into machine code.
Note that NaCl is the formula of sodium chloride, ie the common salt. Salt for your apps...
Software required to develop
The end user will not need for these tools. To develop on Native Client, you will need this software:
- A local server, like Xampp.
- GNU Make to compile the examples or Visual Studio Express under Windows.
- Python for some scripts.
LLVM 3.0 offers a better support to Native Client since December 2, 2011. The new version of the C++ development platform facilitates the creation of applications under Native Client. It was already possible to use it in this context, but it was not in its design. Things have changed. See LLVM 3.0, what's new.
Creating a programming platform for Native Client
The instructions can change over time, look at the Getting Started manual for the last version.
- Download the Native Client SDK specific to an operating system, among Windows, Linux or MacOS.
- Create a directory, for example nacl, and unpack the contents.
- Read the Getting Started manual.
- Try a demonstration from command line.
- Bookmark the nacl/build/native_client page.
nacl is your installation directory. - Close browsers supporting Native Client.
- Install the plugin at command line with scon.bat on Windows and scon on Unix.
To do this, run scon.bat or scon in /nacl/build/native_client/ - Start a local server as Wamp.
- Perform a check with the test page:
http://localhost:5103/scons-out/nacl-x86-32/staging/examples.html
Who is in the directory /nacl/build/native_client/.
With Chrome 14, NaCl has an interface between HTML 5 and the native code named Pepper (Pepper) or more precisely Pepper Plugin API, a new plugin system that replaces the current system invented by Netscape.
On older version you have to enable NaCl. Type about:flags in the address bar of Chrome and go to the entry native client. Click on enable.
Alternative to NaCl : Linux in the browser
With an emulator written entirely in JavaScript, it is possible to run Linux programs from the command line with JSLinux.
For example, try:
tcc-run hello.c
Then type ls to see files in the directory. Or to edit the file type:
emacs hello.c
Tools and documents
- Native Client. The project site on Google Code.
- GTK3 in HTML 5. Rendering a native GTK app into Canvas.
- NaClBox. Port of DOSBox on Native client, to run old games.
- Porting a game on NaCL. An experiment on AirMech.
| Tweet |
|