6 typedef struct TCCState TCCState
;
8 /* create a new TCC compilation context */
9 TCCState
*tcc_new(void);
11 /* free a TCC compilation context */
12 void tcc_delete(TCCState
*s
);
14 /* add debug information in the generated code */
15 void tcc_enable_debug(TCCState
*s
);
17 /*****************************/
20 /* add include path */
21 int tcc_add_include_path(TCCState
*s
, const char *pathname
);
23 /* add in system include path */
24 int tcc_add_sysinclude_path(TCCState
*s
, const char *pathname
);
26 /* define preprocessor symbol 'sym'. Can put optional value */
27 void tcc_define_symbol(TCCState
*s
, const char *sym
, const char *value
);
29 /* undefine preprocess symbol 'sym' */
30 void tcc_undefine_symbol(TCCState
*s
, const char *sym
);
32 /*****************************/
35 /* add a file (either a C file, dll, an object, a library or an ld
37 void tcc_add_file(TCCState
*s
, const char *filename
);
39 /* compile a string containing a C source. Return non zero if
41 int tcc_compile_string(TCCState
*s
, const char *buf
);
44 int tcc_get_error(TCCState
*s
, char *buf
, int buf_size
);
46 /*****************************/
47 /* linking commands */
49 /* set output type. MUST BE CALLED before any compilation */
50 #define TCC_OUTPUT_MEMORY 0 /* output will be ran in memory (no
51 output file) (default) */
52 #define TCC_OUTPUT_EXE 1 /* executable file */
53 #define TCC_OUTPUT_DLL 2 /* dynamic library */
54 #define TCC_OUTPUT_OBJ 3 /* object file */
55 int tcc_set_output_type(TCCState
*s
, int output_type
);
57 /* equivalent to -Lpath option */
58 int tcc_add_library_path(TCCState
*s
, const char *pathname
);
60 /* the library name is the same as the argument of the '-l' option */
61 int tcc_add_library(TCCState
*s
, const char *libraryname
);
63 /* add a symbol to the compiled program */
64 int tcc_add_symbol(TCCState
*s
, const char *name
, unsigned long val
);
66 /* output an executable file */
67 int tcc_output_file(TCCState
*s
, const char *filename
);
69 /* link and run main() function and return its value */
70 int tcc_run(TCCState
*s
, int argc
, char **argv
);