Hi all.
How can I get type of a var in the runtime ?
code:
[CODE=C]
#include "libtcc.h"
const char *my_program =
"extern int myint;\n"
"\n"
"myint=0;\n"
"\n"
"int main(int argc, char ** argv){\n"
"myint=77;\n"
"return 0;\n"
"}\n";
int main(int argc, char ** argv){
TCCState *s;
s = tcc_new();
if (!s) {
fprintf(stderr, "Could not create tcc state\n");
exit(1);
}
tcc_set_lib_path(s, "../");
tcc_set_output_type(s, TCC_OUTPUT_MEMORY);
if (tcc_compile_string(s, my_program) == -1)
return 1;
tcc_run(s, argc, argv);
// HERE is I can not to know what is the type of a var (for example is the
myint now)
// but I need it for sprintf into a buffer (for return the buffer in the
cstring mode for other things)
tcc_delete(s);
return 0;
}
[/CODE]
--
Have a nice day.
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel