From 45feb20bf55c16ee415ef31a356ada67e1df18d6 Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Sun, 11 Jan 2026 22:51:29 +0000 Subject: Some more, and some fixes --- src/main.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 602f06b..d23cd0b 100644 --- a/src/main.c +++ b/src/main.c @@ -192,6 +192,13 @@ int main(int argc, char **argv) // Initialize Plugin Manager zptr_plugin_mgr_init(); + // Parse context init + ParserContext ctx; + memset(&ctx, 0, sizeof(ctx)); + + // Scan for build directives (e.g. //> link: -lm) + scan_build_directives(&ctx, src); + // Register built-in plugins extern ZPlugin brainfuck_plugin; extern ZPlugin befunge_plugin; @@ -210,9 +217,6 @@ int main(int argc, char **argv) Lexer l; lexer_init(&l, src); - // Parse - ParserContext ctx; - memset(&ctx, 0, sizeof(ctx)); ctx.hoist_out = tmpfile(); // Temp file for plugin hoisting if (!ctx.hoist_out) { @@ -262,8 +266,9 @@ int main(int argc, char **argv) // TCC-specific adjustments? // Already handled by user passing --cc tcc - snprintf(cmd, sizeof(cmd), "%s %s %s -o %s out.c -lm -lpthread -I./src", g_config.cc, - g_config.gcc_flags, g_config.is_freestanding ? "-ffreestanding" : "", outfile); + snprintf(cmd, sizeof(cmd), "%s %s %s %s %s -o %s out.c -lm -lpthread -I./src %s", g_config.cc, + g_config.gcc_flags, g_cflags, g_config.is_freestanding ? "-ffreestanding" : "", "", + outfile, g_link_flags); if (g_config.verbose) { -- cgit v1.2.3