History

added better error support

bellard committed 24 years ago

Commit 05a919e1 parent e4c7dd51 file · +13 −9Browse files

Unified · Split

libtcc.h+13−9
@@ -14,6 +14,10 @@ void tcc_delete(TCCState *s); · 13 unmodified lines
1414 /* add debug information in the generated code */
1515 void tcc_enable_debug(TCCState *s);
1616
17+/* set error/warning display callback */
18+void tcc_set_error_func(TCCState *s, void *error_opaque,
19+ void (*error_func)(void *opaque, const char *msg));
20+
1721 /*****************************/
1822 /* preprocessor */
1923
@@ -33,16 +37,13 @@ void tcc_undefine_symbol(TCCState *s, const char *sym); · 13 unmodified lines
3337 /* compiling */
3438
3539 /* add a file (either a C file, dll, an object, a library or an ld
36− script */
37−void tcc_add_file(TCCState *s, const char *filename);
40+ script). Return -1 if error. */
41+int tcc_add_file(TCCState *s, const char *filename);
3842
3943 /* compile a string containing a C source. Return non zero if
4044 error. */
4145 int tcc_compile_string(TCCState *s, const char *buf);
4246
43−/* get last error */
44−int tcc_get_error(TCCState *s, char *buf, int buf_size);
45−
4647 /*****************************/
4748 /* linking commands */
4849
@@ -63,14 +64,17 @@ int tcc_add_library(TCCState *s, const char *libraryname); · 14 unmodified lines
6364 /* add a symbol to the compiled program */
6465 int tcc_add_symbol(TCCState *s, const char *name, unsigned long val);
6566
66−/* output an executable, library or object file */
67+/* output an executable, library or object file. DO NOT call
68+ tcc_relocate() before. */
6769 int tcc_output_file(TCCState *s, const char *filename);
6870
69−/* link and run main() function and return its value */
71+/* link and run main() function and return its value. DO NOT call
72+ tcc_relocate() before. */
7073 int tcc_run(TCCState *s, int argc, char **argv);
7174
72−/* do all relocations (needed before using tcc_get_symbol()) */
73−void tcc_relocate(TCCState *s);
75+/* do all relocations (needed before using tcc_get_symbol()). Return
76+ non zero if link error. */
77+int tcc_relocate(TCCState *s);
7478
7579 /* return symbol value or error */
7680 void *tcc_get_symbol(TCCState *s, const char *name);