From f880243c5af1076eac3b8f2af326640a5d1bb79d Mon Sep 17 00:00:00 2001 From: norly Date: Sun, 13 Jan 2013 18:45:43 +0000 Subject: [PATCH] Add example for program exit code. --- .gitignore | 1 + Makefile | 6 +++++- demo-exitcode.c | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 demo-exitcode.c diff --git a/.gitignore b/.gitignore index 4843672..48ab12e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ demo-printing demo-input-char demo-input-int +demo-exitcode diff --git a/Makefile b/Makefile index 9d326b3..426e6cb 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ LDFLAGS= SRCDIR=src BINDIR=build -all: libmalice.o demo-printing demo-input-char demo-input-int +all: libmalice.o demo-printing demo-input-char demo-input-int demo-exitcode libmalice.o: libmalice.asm nasm $(NASMFLAGS) -o $@ $< @@ -24,6 +24,9 @@ demo-input-char: demo-input-char.o libmalice.o demo-input-int: demo-input-int.o libmalice.o ld $(LDFLAGS) -nostdlib -e _lmStart -o $@ $^ +demo-exitcode: demo-exitcode.o libmalice.o + ld $(LDFLAGS) -nostdlib -e _lmStart -o $@ $^ + .PHONY : clean clean: @@ -31,3 +34,4 @@ clean: rm -f demo-printing rm -f demo-input-char rm -f demo-input-int + rm -f demo-exitcode diff --git a/demo-exitcode.c b/demo-exitcode.c new file mode 100644 index 0000000..5b6ebb1 --- /dev/null +++ b/demo-exitcode.c @@ -0,0 +1,8 @@ +#include "libmalice.h" + +int lmMain(void) +{ + lmPrintString("This demo exits with code 42.\n"); + + return 42; +} -- 2.30.2