1
0
forked from alex-eg/sex

add module testing

Also fix module import
This commit is contained in:
2026-09-14 23:35:48 +03:00
parent 522c5a2c01
commit dae19715df
5 changed files with 80 additions and 7 deletions

View File

@@ -0,0 +1,19 @@
;;; Uses the greet module. Build both, then link them:
;;;
;;; ./sexc example/greet.sex -c -o greet.o
;;; ./sexc example/greet-app.sex -o greet-app -- greet.o
;;;
;;; `(import greet)' pastes greet's public declarations here: `greet'
;;; as a prototype and `greet-count' as an extern. Both keep external
;;; linkage, so they refer to the one definition in greet.o rather than
;;; to private copies.
(include stdio.h)
(import greet)
(pub fn main () int
(greet "world")
(greet "sex")
(printf "%d greetings\n" greet-count)
(return 0))