diff options
| author | grischka <grischka> | 2009-04-16 21:50:43 +0200 |
|---|---|---|
| committer | grischka <grischka> | 2009-04-18 15:08:02 +0200 |
| commit | b1697be6917ecf16013d8467329bccff6a9e5b9f (patch) | |
| tree | f6f07ee593d0978149d85c8a967a89c8515ed482 /libtcc_test.c | |
| parent | 795f67428e7863353d7c466c211d8fcbb9e8c988 (diff) | |
| download | tinycc-b1697be6917ecf16013d8467329bccff6a9e5b9f.tar.gz tinycc-b1697be6917ecf16013d8467329bccff6a9e5b9f.tar.bz2 | |
change tcc_add/get_symbol to use void*
Diffstat (limited to 'libtcc_test.c')
| -rw-r--r-- | libtcc_test.c | 13 |
1 files changed, 6 insertions, 7 deletions
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); |
