Game Development Reference
In-Depth Information
We do not have to list the GyroscopeAvailable function explicitly
in the list of functions. The EDK build process automatically generates
this function for us by taking the name of the S4E file and appending
"Available" to the end of it.
As you can see, the functions are listed almost as if they were normal C function
prototypes. Each function is listed on its own line by first stating the return type and
then its name and parameter list (which all just happen to be empty in this example!).
Additionally, each function in the S4E file function list also specifies a default value
it will return and can be followed by a number of optional directives that control
the behavior of the function, how it is added to the extension, and how it is called.
Our example makes no use of these directives, but the following table shows what
can be specified:
Directive
Description
run_on_osthread
Specifies that the extension function should only be executed
on the main OS thread of the application. This is particularly
important if the function performs any kind of user interface
interaction, as many platforms will only allow UI calls to be
made on the main thread.
no_lock
Disables thread-safe locking when calling this function. By
default all extension functions can only be called on a single
thread at any particular time and locking code is automatically
generated to ensure that this happens.
fast
Enables fast stack switching. This is an optimization option,
which means less data needs to be passed between our
application and the loader when making an extension function
call by using the same stack as the loader module. Normally the
loader module and our application code have separate stacks.
no_assert
Stops an assert from being raised if an extension function is
called on a platform for which the extension has not been built.
The default value for the function will be returned.
Search WWH ::




Custom Search