Updated 2014-06-24 01:02:26 by AMG

tcc, the Tiny C Compiler, originally by Fabrice Bellard, is a tiny but complete ISOC99 C compiler which enables you to use C as a scripting language.
I looked for other compilers and none had the features of Tcc, not even LLVM
Roy Keene, Tcl Chatroom, 2014-06-22

Attributes  edit

website
http://bellard.org/tcc/
website (old)
http://fabrice.bellard.free.fr/tcc
license
LGPL

Development  edit

git repository
Savannah developer page
mailing list archive

See Also  edit

tcc tcl extension, by Colin McCormack
Generate dlls and even dynamically compile C into memory.
tcltcc, by Mark Janssen
features VFS i/o.
Compile Tcl with tcc on SuSE Linux, Reinhard Max, 2003
Small is beautiful
a list of good things that come in small packages
Critcl
embed C code into Tcl scripts. critcl currently can't use tcc. Contributions welcome.
Small Device C Compiler
a retargettable, optimizing ANSI - C compiler suite that targets the Intel MCS51 based microprocessors (8031, 8032, 8051, 8052, etc.), Maxim (formerly Dallas) DS80C390 variants, Freescale (formerly Motorola) HC08 based (hc08, s08) and Zilog Z80 based MCUs (z80, z180, gbz80, Rabbit 2000/3000, Rabbit 3000A). Work is in progress on supporting the Microchip PIC16 and PIC18 targets. It can be retargeted for other microprocessors.

Features  edit

from the tcc homepage:

  • SMALL! You can compile and execute C code everywhere, for example on rescue disks (80KB for x86 TCC executable Larry Smith Compress it with upx [1] and it drops to 56K.)
  • FAST! tcc generates optimized x86 code. No byte code overhead. Compile, assemble and link several times faster than GCC.
  • UNLIMITED! Any C dynamic library can be used directly. TCC is heading torward full ISOC99 compliance. TCC can of course compile itself.
  • SAFE! tcc includes an optional memory and bound checker. Bound checked code can be mixed freely with standard code.
  • Compile and execute C source directly. No linking or assembly necessary. Full C preprocessor included.
  • C script supported: just add '#!/usr/local/bin/tcc' at the first line of your C source, and execute it directly from the command line.
  • With libtcc, you can use TCC as a backend for dynamic code generation.

Description  edit

tinycc currently supports i386, x86-64, arm, OS X, Windows, WinCE, kFreeBSD, and Hurd.

In 2004, Colin McCormack, wrote tcc tcl extension, which Eric Hassold then used as the basis odyce, without crediting Colin.

In 2007, Mark Janssen wrote tcltcc, which features VFS i/o.

Landley Fork  edit

Rob Landley TinyCC in 2006, and for a while most new development was happening on his fork.

In 2007, after some heckling, Landley stopped working as much on his fork, but continued making changes into 2008.

In 2012, he forked is own fork into a new project named Qcc, which hasn't produced a release and isn't currently active.

Misc  edit

RS: Odyce (tcc wrapper in eTcl) contains a partial Critcl emulation - the difference being that no external compiler, linker etc. is needed.

[email protected] 2004-10-27:

I have a working version for windows, and have written a couple examples using Tcl C API's...Works pretty good... Still needs some work....

CMcC: Excellent. The latest version is supposed to work for windows too, the big question is: can your version create .dll files?

[email protected]:

No, what you get is a compiled memory resident code. I use it mainly to quickly test new 'C' code segments or just needed a quick fast function call to perform something (math routine)...

I've compiled the tcc into a DLL and load it into tcl, then load/unload my 'C' scripts...I have put in hooks to call the tcl API so I can create new commands...The main difference is that you use the "main" function the same as the "init" call to initialize the code...

example 'C' script:

AMG 2005-12-08, updated 2014-06-23: I removed the example script because it's horribly corrupted. Look in the revision history [2] if you want to try and salvage it. And remember, when pasting blocks of code in the Tcl wiki, prefix each line with a space character, or use ====== notation. Also proofread the result of your edit to see that it looks the way you intend.

PWQ 2005-01-06: I have used tcc 0.9.22 and I have found there are some differences in execution between compiling with gcc and tcc.

One opengl program does not display any opengl renderings even though the glut menu displays.

I think tcc has some way to go before becoming a contender for a JIT type of extension to TCL.