aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2025-10-29 09:41:02 +0100
committerGitHub <noreply@github.com>2025-10-29 09:41:02 +0100
commitb58bb6519ee348f3693fe9ef81e32879579404ee (patch)
treeffb0508332c31d3d6fe7b8e021145796b88f41ff
parent2508b82878de0790b1508ea8539d40681fa293f6 (diff)
parente05c21522d0613b585013af1ee892cb9ff139512 (diff)
Merge pull request #5860 from harold-b/hb.fix-export-link-libs-file
Fix `-export-linked-libs-file` issue where it multiple libraries in a single foreign export.
-rw-r--r--src/main.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 0af589339..83e7d688c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2296,9 +2296,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;
}
@@ -2319,16 +2320,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");