Building a Native Client Application from Nothing

What does it take to build a Native Client application from scratch? I have looked through the documentation and have worked with several applications, however now I move on to building my own application and I don't see anything related to creating the base of my own client application.


source to share

2 answers

Depending on the version of the SDK you want to use, you have several options.

Pepper 16 & 17: use or use example as a starting point

If you are using pepper_16

or pepper_17

, you will find a Python script

in project_templates

the SDK. It will install a complete set of files (.cc, .html, .nmf) with comments indicating where you need to add the code. Run python -h

to see what parameters it accepts. Additional documentation can be found at .

Pepper 18 and newer: use the example as a starting point

If you are using pepper_18

or newer, it

will no longer turn on. Instead, you can copy a very small example from a directory examples

(for example, hello_world_glibc

either hello_world_newlib

for C or hello_world_interactive

C ++) and use that as a starting point.

Writing completely from scratch

If you want to completely write your application from scratch, first make sure the SDK works by compiling and running a few examples. Then a good next step is to look at the pp :: Module and pp: Instance classes that your application needs to execute.

On the HTML side, write a simple page with an element EMBED

for the Native Client module. Then add the JavaScript event handlers for loadstart

, progress

, error

, abort

, load

, loadend

and message

and event handlers will process the data, for example, in the JavaScript console, so you can say what went wrong, if the Native Client module is not loaded. An example load_progress

shows how to do this.

Then create a manifest file ( .nmf

). From pepper_18

onwards you can use the

script found in the directory tools/

. If you want to write it from scratch, the examples provide examples for both use newlib

and for glibc

(currently two standard C libraries are supported). See hello_world_newlib/

and hello_world_glibc/


If you haven't used the gcc-family compiler before, it is also a good idea to look at the Makefile for some examples to see which compiler and linker flags to use. Compilation is recommended for both 32-bit and 64-bit from the beginning.



The easiest way is to follow the quick start document , specifically steps 5-7 of the tutorial ( / pepper18 / devguide / tutorial ) you are asking about.



All Articles