#include #include #include #include #define SL_IMPLEMENTATION #include #define ASSERT(x) assert(x == 0) void symbol_cb(void* ctx, const char* name, const void* val) { printf("%s\n", name); } int main() { TCCState* state = tcc_new(); ASSERT(tcc_set_output_type(state, TCC_OUTPUT_MEMORY)); ASSERT(tcc_add_include_path(state, "runtime/include")); ASSERT(tcc_add_include_path(state, "env/include")); sl_string file = { 0 }; printf("file: "); char path[512]; scanf("%s", path); sl_read_file(path, &file); ASSERT(tcc_compile_string(state, sl_c_str(file))); ASSERT(tcc_add_library_path(state, "runtime/lib")); ASSERT(tcc_add_library_path(state, "env/lib")); // dumb testing shit ASSERT(tcc_add_library_path(state, "lib")); ASSERT(tcc_add_library(state, "tcc")); ASSERT(tcc_relocate(state)); int (*entry)() = tcc_get_symbol(state, "main"); //tcc_list_symbols(state, NULL, symbol_cb); entry(); tcc_delete(state); }