aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-03-19 14:23:48 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-03-19 14:23:48 -0400
commit71f4da18f27e488035e872f1dc1527b727acdcae (patch)
tree9a1a939629864c8d56e8dc578456c280226652fd
parentadbb07fdc27af677923fb5453b845c7cd7b135a7 (diff)
Prevent mulitple imports
-rw-r--r--compile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 5eb5e7cf..0567dc7d 100644
--- a/compile.c
+++ b/compile.c
@@ -1795,7 +1795,10 @@ module_code_t compile_file(ast_t *ast)
env->code->funcs, "\n",
env->code->typeinfos, "\n",
"\n"
- "public void ", env->file_prefix, "use(void) {\n",
+ "public void ", env->file_prefix, "use(void) {\n"
+ "static bool $loaded = no;\n"
+ "if ($loaded) return;\n"
+ "$loaded = yes;\n\n",
env->code->main,
"}\n"
),