19
19
/* free a TCC compilation context */
20
20
LIBTCCAPI void tcc_delete(TCCState *s);
22
/* add debug information in the generated code */
23
LIBTCCAPI void tcc_enable_debug(TCCState *s);
22
/* set CONFIG_TCCDIR at runtime */
23
LIBTCCAPI void tcc_set_lib_path(TCCState *s, const char *path);
25
25
/* set error/warning display callback */
26
26
LIBTCCAPI void tcc_set_error_func(TCCState *s, void *error_opaque,
27
void (*error_func)(void *opaque, const char *msg));
29
/* set/reset a warning */
30
LIBTCCAPI int tcc_set_warning(TCCState *s, const char *warning_name, int value);
32
/* set linker option */
33
LIBTCCAPI const char * tcc_set_linker(TCCState *s, char *option, int multi);
27
void (*error_func)(void *opaque, const char *msg));
29
/* set options as from command line (multiple supported) */
30
LIBTCCAPI int tcc_set_options(TCCState *s, const char *str);
35
32
/*****************************/
50
47
/*****************************/
53
/* add a file (either a C file, dll, an object, a library or an ld
54
script). Return -1 if error. */
50
/* add a file (C file, dll, object, library, ld script). Return -1 if error. */
55
51
LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename);
57
/* compile a string containing a C source. Return non zero if
53
/* compile a string containing a C source. Return -1 if error. */
59
54
LIBTCCAPI int tcc_compile_string(TCCState *s, const char *buf);
61
56
/*****************************/
62
57
/* linking commands */
64
59
/* set output type. MUST BE CALLED before any compilation */
65
#define TCC_OUTPUT_MEMORY 0 /* output will be ran in memory (no
66
output file) (default) */
60
LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type);
61
#define TCC_OUTPUT_MEMORY 0 /* output will be run in memory (default) */
67
62
#define TCC_OUTPUT_EXE 1 /* executable file */
68
63
#define TCC_OUTPUT_DLL 2 /* dynamic library */
69
64
#define TCC_OUTPUT_OBJ 3 /* object file */
70
#define TCC_OUTPUT_PREPROCESS 4 /* preprocessed file (used internally) */
71
LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type);
73
#define TCC_OUTPUT_FORMAT_ELF 0 /* default output format: ELF */
74
#define TCC_OUTPUT_FORMAT_BINARY 1 /* binary image output */
75
#define TCC_OUTPUT_FORMAT_COFF 2 /* COFF */
65
#define TCC_OUTPUT_PREPROCESS 4 /* only preprocess (used internally) */
77
67
/* equivalent to -Lpath option */
78
68
LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname);
91
81
tcc_relocate() before. */
92
82
LIBTCCAPI int tcc_run(TCCState *s, int argc, char **argv);
94
/* Do all relocations (needed before using tcc_get_symbol())
95
Returns -1 on error. */
96
LIBTCCAPI int tcc_relocate(TCCState *s1);
84
/* do all relocations (needed before using tcc_get_symbol()) */
85
LIBTCCAPI int tcc_relocate(TCCState *s1, void *ptr);
86
/* possible values for 'ptr':
87
- TCC_RELOCATE_AUTO : Allocate and manage memory internally
88
- NULL : return required memory size for the step below
89
- memory address : copy code to memory passed by the caller
90
returns -1 if error. */
91
#define TCC_RELOCATE_AUTO (void*)1
98
93
/* return symbol value or NULL if not found */
99
94
LIBTCCAPI void *tcc_get_symbol(TCCState *s, const char *name);
101
/* set CONFIG_TCCDIR at runtime */
102
LIBTCCAPI void tcc_set_lib_path(TCCState *s, const char *path);
104
96
#ifdef __cplusplus