mirror of
https://github.com/frida/tinycc
synced 2024-12-24 22:16:49 +03:00
api change
This commit is contained in:
parent
3f13ae4961
commit
b2834b35b5
31
libtcc.h
31
libtcc.h
@ -29,10 +29,12 @@ void tcc_undefine_symbol(TCCState *s, const char *sym);
|
||||
/*****************************/
|
||||
/* compiling */
|
||||
|
||||
/* compile a file. Return non zero if error. */
|
||||
int tcc_compile_file(TCCState *s, const char *filename);
|
||||
/* add a file (either a C file, dll, an object, a library or an ld
|
||||
script */
|
||||
void tcc_add_file(TCCState *s, const char *filename);
|
||||
|
||||
/* compile a string. Return non zero if error. */
|
||||
/* compile a string containing a C source. Return non zero if
|
||||
error. */
|
||||
int tcc_compile_string(TCCState *s, const char *buf);
|
||||
|
||||
/* get last error */
|
||||
@ -41,18 +43,25 @@ int tcc_get_error(TCCState *s, char *buf, int buf_size);
|
||||
/*****************************/
|
||||
/* linking commands */
|
||||
|
||||
/* add a DYNAMIC library so that the compiled program can use its symbols */
|
||||
int tcc_add_dll(TCCState *s, const char *library_name);
|
||||
/* set output type. Must be called before any compilation */
|
||||
#define TCC_OUTPUT_MEMORY 0 /* output will be ran in memory (no
|
||||
output file) (default) */
|
||||
#define TCC_OUTPUT_EXE 1 /* executable file */
|
||||
#define TCC_OUTPUT_DLL 2 /* dynamic library */
|
||||
#define TCC_OUTPUT_OBJ 3 /* object file */
|
||||
int tcc_set_output_type(TCCState *s, int output_type);
|
||||
|
||||
/* define a global symbol */
|
||||
int tcc_add_symbol(TCCState *s, const char *name, void *value);
|
||||
/* equivalent to -Lpath option */
|
||||
int tcc_add_library_path(TCCState *s, const char *pathname);
|
||||
|
||||
#define TCC_FILE_EXE 0 /* executable file */
|
||||
#define TCC_FILE_DLL 1 /* dynamic library */
|
||||
#define TCC_FILE_OBJ 2 /* object file */
|
||||
/* the library name is the same as the argument of the '-l' option */
|
||||
int tcc_add_library(TCCState *s, const char *libraryname);
|
||||
|
||||
/* add a symbol to the compiled program */
|
||||
int tcc_add_symbol(TCCState *s, const char *name, unsigned long val);
|
||||
|
||||
/* output an executable file */
|
||||
int tcc_output_file(TCCState *s, const char *filename, int file_type);
|
||||
int tcc_output_file(TCCState *s, const char *filename);
|
||||
|
||||
/* link and run main() function and return its value */
|
||||
int tcc_run(TCCState *s, int argc, char **argv);
|
||||
|
@ -49,7 +49,7 @@ int main(int argc, char **argv)
|
||||
/* 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", (void *)&add);
|
||||
tcc_add_symbol(s, "add", (unsigned long)&add);
|
||||
|
||||
args[0] = "";
|
||||
args[1] = "32";
|
||||
|
Loading…
Reference in New Issue
Block a user