#include const char* code = "#include \n\ extern float add(float a, float b); \n\ int main() { \n\ printf(\"%f\\n\", add(1, 2)); \n\ return 0; \n\ }"; float add(float a, float b) { return a + b; } int main() { void* func; TCCState *s = tcc_new(); tcc_set_output_type(s, TCC_OUTPUT_MEMORY); //tcc_add_symbol(s, "add", (void*) add); if(tcc_compile_string(s, code) == -1 || tcc_relocate(s, TCC_RELOCATE_AUTO) < 0 || !(func = tcc_get_symbol(s, "main"))) { tcc_delete(s); return 1; } ((int (*)()) func)(); //build with tcc seetcc.c -rdynamic -Wall -ldl -ltcc //expected output: tcc: error: undefined symbol 'add' //actual output: 3.000000 tcc_delete(s); return 0; }