change tcc_add/get_symbol to use void*

This commit is contained in:
grischka
2009-04-16 21:50:43 +02:00
parent 795f67428e
commit b1697be691
4 changed files with 19 additions and 22 deletions

View File

@ -35,7 +35,6 @@ int main(int argc, char **argv)
{
TCCState *s;
int (*func)(int);
unsigned long val;
void *mem;
int size;
@ -50,10 +49,9 @@ int main(int argc, char **argv)
tcc_compile_string(s, my_program);
/* as a test, we add a symbol that the compiled program can be
linked with. You can have a similar result by opening a dll
with tcc_add_dll(() and using its symbols directly. */
tcc_add_symbol(s, "add", (unsigned long)&add);
/* as a test, we add a symbol that the compiled program can use.
You may also open a dll with tcc_add_dll() and use symbols from that */
tcc_add_symbol(s, "add", add);
/* get needed size of the code */
size = tcc_relocate(s, NULL);
@ -65,8 +63,9 @@ int main(int argc, char **argv)
tcc_relocate(s, mem);
/* get entry symbol */
tcc_get_symbol(s, &val, "foo");
func = (void *)val;
func = tcc_get_symbol(s, "foo");
if (!func)
return 1;
/* delete the state */
tcc_delete(s);