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
14/* add debug information in the generated code */14/* add debug information in the generated code */
15void tcc_enable_debug(TCCState *s);15void tcc_enable_debug(TCCState *s);
16 16
17/* set error/warning display callback */
18void tcc_set_error_func(TCCState *s, void *error_opaque,
19 void (*error_func)(void *opaque, const char *msg));
20
17/*****************************/21/*****************************/
18/* preprocessor */22/* preprocessor */
19 23
@@ -33,16 +37,13 @@ void tcc_undefine_symbol(TCCState *s, const char *sym); · 13 unmodified lines
33/* compiling */37/* compiling */
34 38
35/* add a file (either a C file, dll, an object, a library or an ld39/* add a file (either a C file, dll, an object, a library or an ld
36 script */40 script). Return -1 if error. */
37void tcc_add_file(TCCState *s, const char *filename);41int tcc_add_file(TCCState *s, const char *filename);
38 42
39/* compile a string containing a C source. Return non zero if43/* compile a string containing a C source. Return non zero if
40 error. */44 error. */
41int tcc_compile_string(TCCState *s, const char *buf);45int tcc_compile_string(TCCState *s, const char *buf);
42 46
43/* get last error */
44int tcc_get_error(TCCState *s, char *buf, int buf_size);
45
46/*****************************/47/*****************************/
47/* linking commands */48/* linking commands */
48 49
@@ -63,14 +64,17 @@ int tcc_add_library(TCCState *s, const char *libraryname); · 14 unmodified lines
63/* add a symbol to the compiled program */64/* add a symbol to the compiled program */
64int tcc_add_symbol(TCCState *s, const char *name, unsigned long val);65int tcc_add_symbol(TCCState *s, const char *name, unsigned long val);
65 66
66/* output an executable, library or object file */67/* output an executable, library or object file. DO NOT call
68 tcc_relocate() before. */
67int tcc_output_file(TCCState *s, const char *filename);69int tcc_output_file(TCCState *s, const char *filename);
68 70
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. */
70int tcc_run(TCCState *s, int argc, char **argv);73int tcc_run(TCCState *s, int argc, char **argv);
71 74
72/* do all relocations (needed before using tcc_get_symbol()) */75/* do all relocations (needed before using tcc_get_symbol()). Return
73void tcc_relocate(TCCState *s);76 non zero if link error. */
77int tcc_relocate(TCCState *s);
74 78
75/* return symbol value or error */79/* return symbol value or error */
76void *tcc_get_symbol(TCCState *s, const char *name);80void *tcc_get_symbol(TCCState *s, const char *name);