Hermes and JSI demo of JSI Host Functions loaded dynamically from shared libraries specified on the command line.
hf-runner
dynamically loads shared libraries specified on the command line
after the input JS files, and calls them to register any native functions into
the global object. Then it executes the input JS file, which can use the registered
natives.
hf-runner <js-file> [<shared-lib> ...]
hf-runner
comes with two example libraries: libhfadd and libhfmyprint. The register
the functions add
and myprint
respectively.
The provided file demo.js
uses both of these functions.
$ hf-runner demo.js libhfadd.so libhfmyprint.so
The shared libraries must export a function named registerNatives
with the following
signature:
void registerNatives(facebook::jsi::Runtime &rt);