Hello everybody -

I'm looking into hooking the Tiny C Compiler into Perl. Among other things,
it can JIT-compile a string of C code and let you get a function pointer
(or a pointer to any other structure of the compiled code that is globally
scoped) that you can subsequently call from your original C program. I
would like to try to use this to build Perl CVs/XSUBs, but I see no
interface for creating an XSUB that is not installed into a package.

The easy work around is to have a designated package into which all such
xsubs are installed and simply use newxs (see
http://perldoc.perl.org/perlembed.html). The name given to the Perl-side
function would be composed from a hashing algorithm of some sort to avoid
collisions. Still, I would really like to create simple function references
without having to create the entry in the package.

Thoughts? Wisdom?
David

P.S. TCC compiles for i686 and ARM hardware. It can create executables for
Windows and Linux (with some work on porting it to Mac OSX). I realize this
is a limited set of platforms, but I suspect a lot of users would still be
able to benefit from it and I would like to get this working. Heck, if this
is successful, it may draw enough developers into the TCC project to get it
working on other hardware.

-- 
 "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

Reply via email to