Module tinyc

Types

PccState = ptr CcState
  Source
ErrorFunc = proc (opaque: pointer; msg: cstring) {.cdecl.}
  Source

Consts

OutputMemory: cint = 0
output will be ran in memory (no output file) (default)   Source
OutputExe: cint = 1
executable file   Source
OutputDll: cint = 2
dynamic library   Source
OutputObj: cint = 3
object file   Source
OutputPreprocess: cint = 4
preprocessed file (used internally)   Source
OutputFormatElf: cint = 0
default output format: ELF   Source
OutputFormatBinary: cint = 1
binary image output   Source
OutputFormatCoff: cint = 2
COFF   Source

Procs

proc openCCState(): PccState {.importc: "tcc_new", cdecl.}
create a new TCC compilation context   Source
proc closeCCState(s: PccState) {.importc: "tcc_delete", cdecl.}
free a TCC compilation context   Source
proc enableDebug(s: PccState) {.importc: "tcc_enable_debug", cdecl.}
add debug information in the generated code   Source
proc setErrorFunc(s: PccState; errorOpaque: pointer; errorFun: ErrorFunc) {.cdecl,
    importc: "tcc_set_error_func".}
set error/warning display callback   Source
proc setWarning(s: PccState; warningName: cstring; value: int) {.cdecl,
    importc: "tcc_set_warning".}
set/reset a warning   Source
proc addIncludePath(s: PccState; pathname: cstring) {.cdecl,
    importc: "tcc_add_include_path".}
add include path   Source
proc addSysincludePath(s: PccState; pathname: cstring) {.cdecl,
    importc: "tcc_add_sysinclude_path".}
add in system include path   Source
proc defineSymbol(s: PccState; sym, value: cstring) {.cdecl,
    importc: "tcc_define_symbol".}
define preprocessor symbol 'sym'. Can put optional value   Source
proc undefineSymbol(s: PccState; sym: cstring) {.cdecl, importc: "tcc_undefine_symbol".}
undefine preprocess symbol 'sym'   Source
proc addFile(s: PccState; filename: cstring): cint {.cdecl, importc: "tcc_add_file".}
add a file (either a C file, dll, an object, a library or an ld script). Return -1 if error.   Source
proc compileString(s: PccState; buf: cstring): cint {.cdecl,
    importc: "tcc_compile_string".}
compile a string containing a C source. Return non zero if error.   Source
proc setOutputType(s: PccState; outputType: cint): cint {.cdecl,
    importc: "tcc_set_output_type".}
set output type. MUST BE CALLED before any compilation   Source
proc addLibraryPath(s: PccState; pathname: cstring): cint {.cdecl,
    importc: "tcc_add_library_path".}
equivalent to -Lpath option   Source
proc addLibrary(s: PccState; libraryname: cstring): cint {.cdecl,
    importc: "tcc_add_library".}
the library name is the same as the argument of the '-l' option   Source
proc addSymbol(s: PccState; name: cstring; val: pointer): cint {.cdecl,
    importc: "tcc_add_symbol".}
add a symbol to the compiled program   Source
proc outputFile(s: PccState; filename: cstring): cint {.cdecl,
    importc: "tcc_output_file".}
output an executable, library or object file. DO NOT call tcc_relocate() before.   Source
proc run(s: PccState; argc: cint; argv: cstringArray): cint {.cdecl, importc: "tcc_run".}
link and run main() function and return its value. DO NOT call tcc_relocate() before.   Source
proc relocate(s: PccState; p: pointer): cint {.cdecl, importc: "tcc_relocate".}
copy code into memory passed in by the caller and do all relocations (needed before using tcc_get_symbol()). returns -1 on error and required size if ptr is NULL   Source
proc getSymbol(s: PccState; name: cstring): pointer {.cdecl, importc: "tcc_get_symbol".}
return symbol value or NULL if not found   Source
proc setLibPath(s: PccState; path: cstring) {.cdecl, importc: "tcc_set_lib_path".}
set CONFIG_TCCDIR at runtime   Source