diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2021-05-26 11:11:42 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2021-05-26 11:48:44 -0400 |
commit | 308d2fcfc4d19b0e97a1fe78249bfa43ae4fe0bd (patch) | |
tree | f38a7ee4f55dc375cdcabd54fc4267b92bc053c0 | |
parent | 2649bf3157c73322a3b124ea9d49e14d7daa3656 (diff) |
Added libtcc-test.c
-rw-r--r-- | libtcc-test.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libtcc-test.c b/libtcc-test.c new file mode 100644 index 0000000..472ad68 --- /dev/null +++ b/libtcc-test.c @@ -0,0 +1,29 @@ +#include <libtcc.h> +#include <stdint.h> +#include <stdio.h> + +const char *files[] = { + "test.c", + "test2.c", + NULL +}; + +int main(int argc, char **argv) { + TCCState *s = tcc_new(); + void (*start)(void); + + tcc_set_output_type(s, TCC_OUTPUT_MEMORY); + + for (int i = 0; files[i]; i++) { + if (tcc_add_file(s, files[i])) { + printf("oof, press f, failed to compile %s.\n", files[i]); + return 1; + } + } + + start = tcc_get_symbol(s, "start"); + + start(); + + return 0; +} |