Module <cweb/cweb.h> — main entry
Via #include <cweb/cweb.h> you pull in the core modules Server, Routing, HTTP, Autofree, Logger, Fileserver, Template, Fetch, Speedbench, and Cwagger in one step.
Macros
REGISTER_FRONTEND_ASSET(func)
- Purpose: Registers a function
void func(void)that runs once at startup (typical: global styles/scripts or asset preprocessing). Uses a constructor attribute — the function is registered automatically beforemain. - Parameters:
func— pointer to a function with no parameters/return value. - Notes: Requires GCC/Clang with support for
__attribute__((constructor)).
Functions
void cweb_register_frontend_asset_function(void (*func)(void))
- Purpose: Adds a callback to an internal list; it can be invoked in batch later.
- Parameters:
func— function executed whencweb_call_all_frontend_asset_functionsruns. - Return: none.
void cweb_call_all_frontend_asset_functions(void)
- Purpose: Calls all previously registered frontend asset functions in registration order (useful before
cweb_run_serverwhen preparing assets). - Parameters: none.
- Return: none.
- Notes: In a starter project typically called right before starting the server.