Google today launched Portable Native Client (PNaCl, pronounced pinnacle) as part of its push to bring native code to more and more platforms. The tool lets developers compile their code once to run on any hardware platform and embed their PNaCl application in any website.
For those who don’t know, PNaCl was recently integrated into Chrome 31 beta, giving developers the ability to execute native code in the browser. It lets them compile C/C++ code into a single executable that runs across all desktop versions of Chrome and Chrome OS with no user installation required.
F**k it, we'll do it live!
Our biggest ever edition of TNW Conference is fast approaching! Join 10,000 tech leaders this May in Amsterdam.
Here’s how it works:
Under the hood, PNaCl works by compiling native C and C++ code to an intermediate representation, rather than architecture-specific representations as in Native Client. The LLVM-style bytecode is wrapped into a portable executable, which can be hosted on a web server like any other website asset. When the site is accessed, Chrome fetches and translates the portable executable into an architecture-specific machine code optimized directly for the underlying device. This translation approach means developers don’t need to recompile their applications multiple times to run across x86, ARM or MIPS devices.
PNaCl is based on Google’s Native Client (NaCl), which “brings the performance and low-level control of native code to modern Web browsers, without sacrificing the security benefits and portability of web applications.” NaCl enables developers to build Web applications from photo editing and audio mixing, to 3D gaming and CAD modeling, by letting them directly leverage the power of the CPU and GPU. Google of course wants to continue pushing apps online for one simple reason: that’s where the company makes the larger majority of its revenue via ads.
Top Image Credit: Shutterstock