wasm: add foreign import and linking of wasm object files

This commit is contained in:
Laytan Laats
2024-07-02 15:28:08 +02:00
parent 5637ed9ecd
commit 6f1cc8071c
6 changed files with 26 additions and 16 deletions

View File

@@ -1178,9 +1178,12 @@ gb_internal void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
if (foreign_library->LibraryName.paths.count >= 1) {
module_name = foreign_library->LibraryName.paths[0];
}
name = concatenate3_strings(permanent_allocator(), module_name, WASM_MODULE_NAME_SEPARATOR, name);
if (!string_ends_with(module_name, str_lit(".o"))) {
name = concatenate3_strings(permanent_allocator(), module_name, WASM_MODULE_NAME_SEPARATOR, name);
}
}
e->Procedure.is_foreign = true;
e->Procedure.link_name = name;