manual c function interop

This commit is contained in:
2026-06-11 22:46:12 +02:00
parent 2a79010a57
commit a5ceb727c1
20 changed files with 725 additions and 74 deletions
+4 -2
View File
@@ -343,11 +343,13 @@ lower :: proc(hir_module: ^hir.Module, allocator := context.allocator) -> ir.Mod
}
append(&module.functions, ir.Function{
link_name=fmt.aprintf("%s", function.link_name, allocator=allocator),
c_abi=function.c_abi,
calling_convention=.C if function.calling_convention == .C else .Brolang,
implementation=.Declaration if function.implementation == .Declaration else .Definition,
linkage=.External if function.linkage == .External else .Internal,
is_main=function.is_main,
param_types=param_types,
result=function.result,
instructions=lower_body(hir_module, function, allocator),
instructions=nil if function.implementation == .Declaration else lower_body(hir_module, function, allocator),
problematic=function.problematic,
})
}