diff --git a/.gitignore b/.gitignore index 31a332b..348204b 100755 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ *.a *.test *.obj +*.pdb +*.ilk build/ plugins_install/ diff --git a/programs/Makefile b/programs/Makefile index f09e501..50dcc9d 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -1,10 +1,16 @@ -all: compiled\Twice.exe compiled\JustOpen.exe +CC = cl +CFLAGS = /Zi /Od /link /MACHINE:X64 + +all: compiled\Foo.exe compiled\Twice.exe compiled\JustOpen.exe clean: del /Q "compiled\*" +compiled\Foo.exe: source\Foo.c + $(CC) /Fe:$@ source\Foo.c comdlg32.lib $(CFLAGS) + compiled\Twice.exe: source\Twice.c - cl /Fe:$@ source\Twice.c comdlg32.lib /link /MACHINE:X64 + $(CC) /Fe:$@ source\Twice.c comdlg32.lib $(CFLAGS) compiled\JustOpen.exe: source\JustOpen.c - cl /Fe:$@ source\JustOpen.c comdlg32.lib /link /MACHINE:X64 \ No newline at end of file + $(CC) /Fe:$@ source\JustOpen.c comdlg32.lib $(CFLAGS) \ No newline at end of file diff --git a/programs/compiled/Foo.exe b/programs/compiled/Foo.exe new file mode 100644 index 0000000..6bc31ac Binary files /dev/null and b/programs/compiled/Foo.exe differ diff --git a/programs/compiled/JustOpen.exe b/programs/compiled/JustOpen.exe index f397866..7133fb7 100644 Binary files a/programs/compiled/JustOpen.exe and b/programs/compiled/JustOpen.exe differ diff --git a/programs/compiled/Twice.exe b/programs/compiled/Twice.exe index 53a5f09..ab03c2c 100644 Binary files a/programs/compiled/Twice.exe and b/programs/compiled/Twice.exe differ diff --git a/programs/source/Foo.c b/programs/source/Foo.c new file mode 100644 index 0000000..890483a --- /dev/null +++ b/programs/source/Foo.c @@ -0,0 +1,32 @@ +#include <stdio.h> +#include <stdlib.h> + +int test(int a, int b) { + if (a + b >= 1000) { + fprintf(stderr, "CRITICAL ERROR!!!\n"); + exit(1); + } + + return a + b; +} + +int main(int argc, char **argv) { + if (argc < 3) { + fprintf(stderr, "Usage: %s <a> <b>\n", argv[0]); + exit(1); + } + + int a, b; + if (EOF == sscanf(argv[1], "%d", &a)) { + fprintf(stderr, "%s is not a valid integer\n", argv[1]); + exit(1); + } + + if (EOF == sscanf(argv[2], "%d", &b)) { + fprintf(stderr, "%s is not a valid integer\n", argv[2]); + exit(1); + } + + fprintf(stdout, "%d\n", test(a, b)); + return 0; +} \ No newline at end of file