Discussion:
Announcement: Alien Module and Bindings for the Tiny C Compiler
David Mertens
2013-08-21 12:11:50 UTC
Permalink
Hello everyone!

I have finally written and uploaded the first version of Alien::TinyCC and
the second version of C::TinyCompiler. I am spamming all of you because
either (1) it seems appropriate for the list or (2) I think that you might
be interested based on personal conversations we've had.

*The Tiny C Compiler* is a small, fast, nearly C99 compliant C compiler
written for Linux and Windows, which can also compile object code on Mac
(but cannot produce Mach-O executables or dylibs). It targets 32- and
64-bit Intel instruction sets as well as ARM architectures. The compiler is
very fast, but what you get in compile-time speed you lose in non-optimized
machine code. However, it's still machine code, and it offers a library
that includes functionality for compiling arbitrary strings of C code at
runtime! For development, see http://savannah.nongnu.org/projects/tinycc.

*C::TinyCompiler* provides an interface to using that just-in-time
compilation capability, as well as a framework for building reusable
components in the system. If you are using one of the major platforms and
have to generate code at runtime, this will probably be a better tool for
you than Inline::C. If your C code is static, the one-time hit for
compilation will pay for itself with the caching mechanism, and the code
will execute faster, so you're better off sticking with Inline::C in that
case. For development, see https://github.com/run4flat/perl-TCC.

*Alien::TinyCC* installs the Tiny C Compiler to a non-invasive location
which is almost certainly not in the user's path, but the module itself
fiddles with $ENV{PATH} and, possibly, $ENV{LD_LIBRARY_PATH} to ensure that
the compiler and its main library are available within the Perl environment
that invokes the module. Note that this module does not pay any attention
to a local install of tinycc, it *always* installs tcc under the
distribution sharedir for Alien::TinyCC. For development, see
https://github.com/run4flat/Alien-TinyCC.

*New as of this morning* is the Alien module, and the modification to
C::TinyCompiler to use it. Now C::TinyCompiler has a decent chance of
building and operating on the most popular systems. I expect to hit a few
bumps, of course, so I am writing to solicit *testing and feedback*.

Please spread the word to any and all who might be interested. Also, there
is plenty of room for improving C::TinyCompiler, especially fleshing out
C::TinyCompiler::Perl as well as making C::TinyCompiler::Callable more
efficient. I would also be happy to see modules that provide
C::TinyCompiler interfaces to C libraries.

Thanks!
David
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." -- Brian Kernighan
Loading...