aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-17 09:46:23 +0000
committer_ov4 <ov4@ov4.org>2026-10-17 09:46:23 +0000
commit0305500e31eda6fe6da84f88748fc20843aebbce (patch)
tree0ca372b3337764e8cd44e5477fcee63a371fbd26 /tools
parentc62473ae0f495c280759e8f285e5366855ad7a52 (diff)
refactor(runtime): write runtime diagnostics with fprintf(stderr)
Replace snprintf+write(2) with a single fprintf call on the platform's stderr: the C library's stderr / __stderrp, or __acrt_iob_func(2) on Windows, which the embedded runner binds to the host shim. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/driver/EmbeddedRunner.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/driver/EmbeddedRunner.cc b/tools/driver/EmbeddedRunner.cc
index 7f0b763..8bfeccb 100644
--- a/tools/driver/EmbeddedRunner.cc
+++ b/tools/driver/EmbeddedRunner.cc
@@ -325,6 +325,12 @@ static llvm::Error defineRuntimeSymbols(llvm::orc::LLJIT &J) {
ExecutorSymbolDef::fromPtr(&std::strtoll);
#endif
#ifdef _WIN32
+ // Generated diagnostics write to stderr through __acrt_iob_func(2). The
+ // msvcrt DLL only exports __iob_func, so bind the host's shim directly.
+ Symbols[Intern("__acrt_iob_func")] =
+ ExecutorSymbolDef::fromPtr(&__acrt_iob_func);
+#endif
+#ifdef _WIN32
// The JIT-generated main references __main on MinGW; provide a no-op so
// the host CRT is not initialized a second time.
Symbols[Intern("__main")] =