Exported APIs
Build several host APIs from one Wax project without changing its source namespaces.
A build profile selects exported APIs through --build-profile. It is unrelated
to --profile, which adds performance instrumentation and is described in
Profile a program.
Define build profiles
By default, an embedded build exports every api fn. A build profile selects a
smaller set. Create wax.json with an embedded runtime and host bindings:
{
"name": "MyApp",
"version": "0.1.0",
"build": {
"runtime": "embedded",
"bindings": ["c"],
"outputDirectory": "Generated",
"profiles": {
"runtime": {
"api": ["MyApp::Init", "MyApp::Tick", "MyApp::RenderFrame"]
},
"editor": {
"appName": "MyAppEditor",
"api": ["MyApp::Editor::*"]
}
}
}
}
For a complete example, create Src/App.wax:
api fn Init() { }
api fn Tick() { }
api fn RenderFrame() { }
Create Src/Editor.wax:
namespace Editor;
api fn Inspect() { }
Select a profile while building:
wax build --build-profile runtime
wax build --build-profile editor
A build target chooses how an artifact is made. A profile chooses which API it exposes. They can be selected together.
Select API functions
Selectors use qualified Wax names:
MyApp::Tick
MyApp::Editor::Inspect
MyApp::Editor::*
MyApp::Editor::class::Console::Write
A trailing * selects every API whose qualified name begins with that prefix.
Static class methods include the class path component so a class and namespace
with the same name remain distinct. Bare declaration names, unmatched selectors,
and invalid patterns are rejected.
An API function omitted from the profile may still be compiled when selected code calls it. It is not exported and does not appear in generated host bindings.
Generated names
Without appName, Wax appends the profile name to the project name. Selecting
runtime from MyApp therefore produces MyApp_runtime. Set appName when the
host ABI needs another stable name. Its value must be a valid C identifier made
from letters, digits, and underscores, and it cannot begin with a digit.
The generated name controls ABI prefixes, binding names, output names, and launcher metadata. It does not change the Wax package name or source namespaces.