diff options
-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; +} |