Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
libtcc
Rust binding for tcc.
- API Documentation (Releases)
- Cargo package: libtcc
TinyCC (or tcc) is short for Tiny C Compiler. It's a SMALL, FAST, UNLIMITED,SAFE C language Compiler. This crate provide a safe wrapper for libtcc, which supports jit compilation and low level control of code generation.
Usage
To use libtcc
, add this to your Cargo.toml
:
[]
= "0.1.1"
Install tcc
Although this crate take tcc
as part of itself, you still need to install tcc on your env.
The reasons are:
- libtcc.a need small but necessary runtime library(such as libtcc1.a) and some header files defined by tcc(such as stddef.h)
- The purpose of using tcc as part of this crate is to support cross compilation, you still need tcc to be installed in your target env and installation of tcc in target env should not change install prefix.
Initialize Guard
Tcc uses global variable during one compilation, which means user can not compile programs simultaneously.
To prevent incorrect usage, we provide Guard
. Only one guard can exist in a specific scope and every instance
of tcc hold a mutable reference to a guard so that rust compiler can detects incorrect usage via borrow checker.
use ;
In memory compilation
use ;
use CString;
More example
There are examples which provide more information.
Contributing
All contributions are welcome, if you have a feature request don't hesitate to open an issue!
License
This project is licensed under of
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)