aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHarold Brenes <harold@hbrenes.com>2025-10-28 20:21:24 -0400
committerHarold Brenes <harold@hbrenes.com>2025-10-28 20:21:24 -0400
commite05c21522d0613b585013af1ee892cb9ff139512 (patch)
tree31b95f001796a011ac3532dc7c28a9169e722f3e /src
parent81375e52ce89af8ce95ec933312ad3b2cb30311b (diff)
Fix `-export-linked-libs-file` issue where it multiple libraries in a single foreign export.
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 4cc53f319..a0736d92a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2289,9 +2289,10 @@ gb_internal void export_linked_libraries(LinkerData *gen) {
for (auto *e : gen->foreign_libraries) {
GB_ASSERT(e->kind == Entity_LibraryName);
+ ast_node(imp, ForeignImportDecl, e->LibraryName.decl);
- for (auto lib_path : e->LibraryName.paths) {
- lib_path = string_trim_whitespace(lib_path);
+ for (isize i = 0; i < e->LibraryName.paths.count; i++) {
+ String lib_path = string_trim_whitespace(e->LibraryName.paths[i]);
if (lib_path.len == 0) {
continue;
}
@@ -2312,16 +2313,15 @@ gb_internal void export_linked_libraries(LinkerData *gen) {
}
gb_fprintf(&f, "\t");
- ast_node(imp, ForeignImportDecl, e->LibraryName.decl);
- for (Ast* file_path : imp->filepaths) {
- GB_ASSERT(file_path->tav.mode == Addressing_Constant && file_path->tav.value.kind == ExactValue_String);
- String file_path_str = file_path->tav.value.value_string;
- if (string_starts_with(file_path_str, str_lit("system:"))) {
- gb_fprintf(&f, "system");
- } else {
- gb_fprintf(&f, "user");
- }
+ Ast *file_path = imp->filepaths[i];
+ GB_ASSERT(file_path->tav.mode == Addressing_Constant && file_path->tav.value.kind == ExactValue_String);
+ String file_path_str = file_path->tav.value.value_string;
+
+ if (string_starts_with(file_path_str, str_lit("system:"))) {
+ gb_fprintf(&f, "system");
+ } else {
+ gb_fprintf(&f, "user");
}
gb_fprintf(&f, "\n");