Version 33 of tcc

Updated 2007-10-09 15:30:02 by suchenwi

The Tiny C Compiler

http://fabrice.bellard.free.fr/tcc

The actually maintained fork of tcc is TinyCC http://www.landley.net/code/tinycc/

AMG: As of 4 Oct 2007, TinyCC is said to be abandoned. [L1 ]

LV I don't know that I agree with that analysis. What you point to is a blog by one tinycc developer. His blog points to a post to the tinycc mailing list, asking him to go play with his fork of tinycc if he was going to reject input from users of his fork.

I don't see any indication that the primary tinycc developers are abandoning the work - just landley and his branch at landley.net. - RS 2007-10-09: The mailing list [L2 ] has a few daily posts in recent days... but for us Tclers, hanging on MJs branch (with VFS i/o, see below) may be better-fitting.


Features (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 [L3 ] 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.

Reinhard Max has tried to Compile Tcl with tcc on SuSE Linux.

LGPL.

CMcC has written a tcc tcl extension - generate dlls and even dynamically compile C into memory.


Is there a way to combine critcl and one of these small c compilers? - RS: Odyce (tcc wrapper in eTcl) contains a partial Critcl emulation - the difference being that no external compiler, linker etc. is needed.


[Of possible interest to the same readers is this [L4 ] small compiler.]

LES: Are you sure it's for i386 only? What about this? [L5 ]

SDCC can generate code only for Intel 8051, Maxim 80DS390 and Zilog Z80, with Motorola 68HC08 and Microchip PIC16 and PIC18 in the works. Tcl runs on none of these, AFAIK.


See also: Small is beautiful


October 27, 2004 [email protected]:

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 8 Dec 2005: I removed the example script because it's horribly corrupted. Look in the revision history 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. Also proofread the result of your edit to see that it looks the way you intend.

PWQ 6 Jan 2005, 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.

HJG 2005-12-08: Link appears dead "Server not found" - RS 2007-10-01: Link is alive, but latest news is of Jun 17, 2005, so tcc may be, umm, dormant. It could also have begun a new life in odyce ... :^)


RS 2007-10-06: Another tcc adaption to Tcl, as a regular loadable package, is currently in the making - contact MJ. I'm testing it on W95/Tcl 8.4.5, and it looks nice so far :^)

MJ - Source code is now hosted at GoogleCode [L6 ]


[ Category Language ]