blob: 472ad68013f595806db0c9abdd27a4bc95644da5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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;
}
|