NaCl, native client

NaCl is an obsolete technology, now replaced by WebAssembly. It has not been supported by Google's Chrome browser since 2018. This article has purely historical interest .

Native Client's proprietary API wants to speed up web applications to the point of giving them the speed of 3D games by allowing it to spin programmed software in C or C++ or another language in a browser.
This allows web applications to execute compiled native code. It is protected in the same way as JavaScript. This may allow the browser to provide an alternative to the Metro interface in Windows 8.

The native client, abbreviated as NaCl, was supported in the Chrome browser. Firefox supported it with a plugin. Google encouraged game developers to make a Chrome version of their game. The Unity 3D platform automatically creates a browser version .
Google itself ported the QuickOffice office software purchased in 2012 to NaCl, thus providing an alternative to Office in the browser.

To make the code more portable, the developers linked NaCl to the LLVM compiler, which produces intermediate code that is compiled, in turn, into machine code. This version, Portable NaCl, looks more convenient in every way.

Note that NaCl is also the formula for sodium chloride, i.e. table salt. Salt in your apps...

In June 2015, Google announced participation, along with other browser editors, in the bytecode WebAssembly project running in the browser. This new backend combines the benefits of Asm.js with the benefits of NaCl, with which you can predict who Google will stop supporting NaCl in the near future.

Create a programming platform for your own client

To develop on your native client, you may need this software (the end user does not need it).

LLVM has grown close to "Native Client" since December 2, 2011. The new version of the C++ development platform simplifies the creation of applications for the Native Client. It could already be used within this framework, but this was not provided for in its design. Everything has changed.

This way of working can change over time. Check out the Getty Started guide for the latest version.

  1. Download your own client for Windows, Linux or MacOS.
  2. Create a directory, such as nacl, and cancel archiving the content.
  3. Read the Getty started guide. (English).
  4. Try one of the command line demonstrations.
  5. Bookmarker page nacl/build/native_client.
    nacl is your installation directory.
  6. Close browsers that support Native Client.
  7. Install command line plugin with scon.bat under Windows and scon under Unix .
    To do this, run scon.bat or scon in/ nacl/build/native_client/
  8. Starts a local Wamp server.
  9. Test using test page:
    http ://localhost: 5103/scons-out/nacl-x86-32/staging/examples.html
    Who is in the directory/ nacl/build/native_client /.

For detailed instructions, see the C tutorial for your customer.

With Chrome 14, NaCl has an interface between HTML 5 and native code called Pepper (Piment) or, more precisely, Pepper Plugin API - a new plugin system that replaces the current system invented by Netscape. But this system is proprietary and is one of the reasons why NaCl never wore Firefox, except that Mozilla has an alternative in Asm.js.

On older versions of Chrome, you need to activate NaCl. Type about: flags in the Chrome address bar and go to your own client. Click enable.

PNaCl, one compilation for all systems

Portable Native Client, where PNaCl is pronounced pinnacle and is an addition to NaCl that should eliminate the disadvantage of compiling an application for each system. This is a toolkit that converts the NaCl application into LLVM bitcode. The latter, which is contained in the .pexe file, can be automatically converted to binary code upon execution.
You can immediately start LLVM with a virtual machine after implementation in a browser. This makes PNaCl an alternative to Asm.js.
The PNaCl compiler is built into version 31 of Chrome. It converts the LLVM code on the server into machine language on the client computer. Therefore, it is possible to have C++ code or any other language running in the browser, for example JavaScript!

Launching apps in a browser, another easy way...

This can be an alternative to NaCl if you want to run native applications in your browser.
Using an emulator written entirely in JavaScript, you can run Linux programs on the command line using JSLinux.

For example, try:

tcc -run hello.c

Then type ls to see the files in the directory.
Or to edit a file:

emacs hello.c

Another solution was invented - to run the native GTK application in Canvas. (English). Starting with version 3.2, GTK allows you to run native applications in a browser, a priori on a Linux system, with a special backend called Broadway. It's not that mobile.

See also...