26 exported symbols · inventory checked against src/script/tcc_host.h
Nested Compilation & VFS Reference
The foundation of the application-level plugin system: scripts can create further TCC compilers, compile new code and resolve symbols. The recommended entry point is xsCreateTCC — it presets the standard include/lib paths and the full host symbol import; the tables below are the complete capability surface underneath it.
What xsCreateTCC presets
Preset
Contents
Output type
TCC_OUTPUT_MEMORY — the compilation product stays purely in memory, never touching disk
include paths
the app's dev_inc + the VFS-built-in SDK (xsbase.h / xrt_decl.h / libtcc.h)
Symbol imports
the same four-layer symbol table as the host: xrt 3,030 + the XServer contract 20 + libtcc/VFS 26 + extensions (per variant)
System libraries
msvcrt/kernel32 automatic on Windows; 7 system libraries explicitly available
In other words: nested-compiled code holds the same privileges as host scripts — it can call every API (including nesting further). That is power and responsibility; the boundary discussion is in chapter 40 and chapter 44.
Compiler control (18)
Function
Purpose
tcc_new / tcc_delete
create / destroy a compiler instance (before delete, ensure the product's symbols are no longer in use)
tcc_set_lib_path / tcc_set_options
library search root / command-line-style options
tcc_set_error_func
compile-error callback (defaults to stderr — plugin scenarios should take it over)
tcc_add_include_path / tcc_add_sysinclude_path
ordinary / system header search paths
tcc_define_symbol / tcc_undefine_symbol
predefine / undefine macros (e.g. the extension switch XS_USE_SQLITE=1)
tcc_add_library_path / tcc_add_library
library directory / libraries to link (works with the app's dev_lib)
tcc_add_file
compile a source file (disk or VFS path)
tcc_add_symbol
register a host symbol (name → address) — the channel by which plugins call the host
tcc_set_output_type
output shape (plugins use MEMORY)
tcc_compile_string
compile a source string — the main entry for expression evaluation / dynamic plugins
tcc_output_file
output to a file (for exporting .dll/.so; not used in plugin mode)
tcc_relocate
link & relocate into memory — symbols can only be fetched afterwards
tcc_get_symbol
fetch a product symbol's address by name (call it as soon as you hold the function pointer)
mount memory as a VFS path — the channel for injecting headers/sources at runtime
The VFS's static contents (SDK headers, TCC includes, system library definitions) are covered in the VFS resources reference; mount_memory lets you hand the nested compiler files "out of thin air" at runtime — that is exactly how the host loads its own scripts (sources are mounted at the virtual path /xs/script/%p.c and then add_file'd).