November 2019
Intermediate to advanced
448 pages
15h 6m
English
Chapter 5 has two exercises.
Which keyword do you need to use to define a signature in your C or C++ code so that the compiler knows the function will be available when the code is run?
extern
Suppose you need to include a function in Emscripten’s JavaScript code that your module will call to determine if the user’s device is online or not. How would you include a function called IsOnline that returns 1 for true and 0 (zero) for false?
In your C code, you’d define the function as shown in the following snippet:
extern int IsOnline();
When needed, your C code calls the IsOnline function as it would any other function. For example,
if (IsOnline() == 1) { /* request data ...Read now
Unlock full access