From b1697be6917ecf16013d8467329bccff6a9e5b9f Mon Sep 17 00:00:00 2001 From: grischka Date: Thu, 16 Apr 2009 21:50:43 +0200 Subject: change tcc_add/get_symbol to use void* --- libtcc_test.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'libtcc_test.c') diff --git a/libtcc_test.c b/libtcc_test.c index 4c16902..d257a72 100644 --- a/libtcc_test.c +++ b/libtcc_test.c @@ -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); -- cgit v1.3.1