welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
Loading...
Searching...
No Matches
module.hpp File Reference

Full-automation entry point for the trampoline-generator rod: the WELDER_TRAMPOLINES_MAIN generator-main() macro. More...

#include <fstream>
#include <iostream>
#include <welder/rods/python/trampolines/rod.hpp>
Include dependency graph for module.hpp:

Go to the source code of this file.

Macros

#define WELDER_TRAMPOLINES_MAIN(ns)
 Define a main() that emits the trampoline header for namespace ns.

Detailed Description

Full-automation entry point for the trampoline-generator rod: the WELDER_TRAMPOLINES_MAIN generator-main() macro.

Include this (instead of rod.hpp) in a trampoline-generator TU so the whole executable is one macro line; welder_generate_trampolines() (CMake) builds and runs it into <name>.trampolines.hpp.

Definition in file module.hpp.

Macro Definition Documentation

◆ WELDER_TRAMPOLINES_MAIN

#define WELDER_TRAMPOLINES_MAIN ( ns)
Value:
int main(int argc, char** argv) { \
if (argc > 1) { \
::std::ofstream welder_out_{argv[1]}; \
::welder::rods::trampolines::rod::generate<^^ns>(welder_out_); \
} else { \
::welder::rods::trampolines::rod::generate<^^ns>(::std::cout); \
} \
return 0; \
}

Define a main() that emits the trampoline header for namespace ns.

Writes to the file named by the first command-line argument, or to stdout when none is given. The build-time analogue of a backend entry point: a generator executable links this and welder_generate_trampolines runs it with the output path to produce the trampoline header consumed by the real binding TU.

Parameters
nsthe top-level namespace / module name token.

Definition at line 23 of file module.hpp.