Run inline C code on the fly.
Tested on:
- Linux with nodejs 6.11 64 bit, (gcc 4.8 on x86, gcc 6.3 on ARM)
- Windows 10 with nodejs 6.11 32 and 64 bit
- OSX 10.10 with nodejs 6.10, llvm 3.5 (Cave! TCC is not fully ported to OSX, support is experimental!)
Features
- inline C functions in JS
- JS callbacks in C
- wchar_t, struct and array support
- async compilation support
Documentation
See the API documentation.
Usage
const tcc = ; // create a code generatorlet gen = tcc;// create a compile statelet state = tcc; // declare a C functionlet c_func = tcc;gen; // add a JS function declaration to Clet js_func = tcc;gen; // compile code and relocatestate;state; // resolve symbols between C and JSgen; // now the C stuff is usableconsole; // --> prints 1031
See demos and tests for more usage examples.