examples/snake: ncurses snake demo
Small interactive demo wired through the new dynamic linker. Uses libncurses and libc via @symbol bindings; the Makefile runs the unmodified `ww build` pipeline with -l ncurses -l c -L /usr/lib. Resulting binary has libncurses.so.6 + libc.so.6 in NEEDED. Workaround: state struct keeps no array fields and threads the xs/ys body buffers through main()'s frame, because the current 6c codegen segfaults on `&struct.field`. Once that's fixed the arrays can move into state and place_food / step / render lose their *i32 parameters.
This commit is contained in:
16
examples/snake/Makefile
Normal file
16
examples/snake/Makefile
Normal file
@@ -0,0 +1,16 @@
|
||||
# examples/snake — built with the ww toolchain only (6c → 6a → 6l).
|
||||
#
|
||||
# `ww build` does the whole pipeline. -l ncurses -l c routes through
|
||||
# 6l's dynamic linker (PT_INTERP + PT_DYNAMIC + PLT/GOT), so the
|
||||
# resulting binary maps libncurses.so.6 + libc.so.6 at runtime via
|
||||
# the system loader. No cc.
|
||||
|
||||
WW := $(shell cd ../..; pwd)/out/bin/ww
|
||||
|
||||
snake: snake.ww
|
||||
$(WW) build snake.ww -L /usr/lib -l ncurses -l c
|
||||
|
||||
clean:
|
||||
rm -f snake snake.o snake.s snake.combined.ww
|
||||
|
||||
.PHONY: clean
|
||||
Reference in New Issue
Block a user