Module system

This commit is contained in:
nub31
2025-09-11 23:03:44 +02:00
parent 9c2975d45f
commit 0e442a8c4a
15 changed files with 265 additions and 167 deletions

View File

@@ -1,9 +1,20 @@
module "main"
import "test"
extern "puts" func puts(text: cstring)
export extern "puts" func puts(text: cstring)
struct Human
{
name: cstring
age: u64
}
func main(args: []cstring): i64
{
puts("test")
let me: main::Human = {
name = "Oliver"
age = 21
}
return 0
}

View File

@@ -4,7 +4,7 @@ out: .build/out.o
gcc -nostartfiles -o out x86_64.s .build/out.o
.build/out.o: $(NUBC) main.nub
$(NUBC) main.nub module.nub
$(NUBC) main.nub
.PHONY: $(NUBC)
$(NUBC):