# std/tinyc

Theme:

- Manual
- Standard library
- Index
- Compiler docs
- Fusion docs
- devel, stable

Search:
Source Edit

# Types

    ErrorFunc = proc (opaque: pointer; msg: cstring) {.cdecl.}

  Source Edit

    PccState = ptr CcState

  Source Edit

# Consts

    OutputDll: cint = 3

  dynamic library Source Edit

    OutputExe: cint = 2

  executable file Source Edit

    OutputMemory: cint = 1

  output will be ran in memory (no output file) (default) Source Edit

    OutputObj: cint = 4

  object file Source Edit

    OutputPreprocess: cint = 5

  preprocessed file (used internally) Source Edit

# Procs

    proc addFile(s: PccState; filename: cstring): cint {.cdecl,
        importc: "tcc_add_file", ...raises: [], tags: [], forbids: [].}

  add a file (either a C file, dll, an object, a library or an ld script). Return -1 if error. Source Edit

    proc addIncludePath(s: PccState; pathname: cstring) {.cdecl,
        importc: "tcc_add_include_path", ...raises: [], tags: [], forbids: [].}

  add include path Source Edit

    proc addLibrary(s: PccState; libraryname: cstring): cint {.cdecl,
        importc: "tcc_add_library", ...raises: [], tags: [], forbids: [].}

  the library name is the same as the argument of the '-l' option Source Edit

    proc addLibraryPath(s: PccState; pathname: cstring): cint {.cdecl,
        importc: "tcc_add_library_path", ...raises: [], tags: [], forbids: [].}

  equivalent to -Lpath option Source Edit

    proc addSymbol(s: PccState; name: cstring; val: pointer): cint {.cdecl,
        importc: "tcc_add_symbol", ...raises: [], tags: [], forbids: [].}

  add a symbol to the compiled program Source Edit

    proc addSysincludePath(s: PccState; pathname: cstring) {.cdecl,
        importc: "tcc_add_sysinclude_path", ...raises: [], tags: [], forbids: [].}

  add in system include path Source Edit

    proc closeCCState(s: PccState) {.importc: "tcc_delete", cdecl, ...raises: [],
                                     tags: [], forbids: [].}

  free a TCC compilation context Source Edit

    proc compileString(s: PccState; buf: cstring): cint {.cdecl,
        importc: "tcc_compile_string", ...raises: [], tags: [], forbids: [].}

  compile a string containing a C source. Return non zero if error. Source Edit

    proc defineSymbol(s: PccState; sym, value: cstring) {.cdecl,
        importc: "tcc_define_symbol", ...raises: [], tags: [], forbids: [].}

  define preprocessor symbol 'sym'. Can put optional value Source Edit

    proc getSymbol(s: PccState; name: cstring): pointer {.cdecl,
        importc: "tcc_get_symbol", ...raises: [], tags: [], forbids: [].}

  return symbol value or NULL if not found Source Edit

    proc openCCState(): PccState {.importc: "tcc_new", cdecl, ...raises: [], tags: [],
                                   forbids: [].}

  create a new TCC compilation context Source Edit

    proc outputFile(s: PccState; filename: cstring): cint {.cdecl,
        importc: "tcc_output_file", ...raises: [], tags: [], forbids: [].}

  output an executable, library or object file. DO NOT call tcc_relocate() before. Source Edit

    proc relocate(s: PccState; p: pointer): cint {.cdecl, importc: "tcc_relocate",
        ...raises: [], tags: [], forbids: [].}

  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 Edit

    proc run(s: PccState; argc: cint; argv: cstringArray): cint {.cdecl,
        importc: "tcc_run", ...raises: [], tags: [], forbids: [].}

  link and run main() function and return its value. DO NOT call tcc_relocate() before. Source Edit

    proc setErrorFunc(s: PccState; errorOpaque: pointer; errorFun: ErrorFunc) {.
        cdecl, importc: "tcc_set_error_func", ...raises: [], tags: [], forbids: [].}

  set error/warning display callback Source Edit

    proc setLibPath(s: PccState; path: cstring) {.cdecl,
        importc: "tcc_set_lib_path", ...raises: [], tags: [], forbids: [].}

  set CONFIG_TCCDIR at runtime Source Edit

    proc setOptions(s: PccState; options: cstring) {.cdecl,
        importc: "tcc_set_options", ...raises: [], tags: [], forbids: [].}

  set a options Source Edit

    proc setOutputType(s: PccState; outputType: cint): cint {.cdecl,
        importc: "tcc_set_output_type", ...raises: [], tags: [], forbids: [].}

  set output type. MUST BE CALLED before any compilation Source Edit

    proc undefineSymbol(s: PccState; sym: cstring) {.cdecl,
        importc: "tcc_undefine_symbol", ...raises: [], tags: [], forbids: [].}

  undefine preprocess symbol 'sym' Source Edit