A follow-up to this email: On Fri, May 23, 2014 at 8:35 AM, David Mertens <dcmertens.p...@gmail.com> wrote:
> Hey everyone, > > C::Blocks is a new TinyCC-based module, presently only available on > github. (1) It jit-compiles blocks of C code, building and inserting OPs > into the Perl OP tree, making invocation of C code essentially free. (2) It > will allow different blocks of C code to share function and struct > declarations, thus removing the need to always recompile perl.h, an > otherwise major cost of jit-compiling C code that can interface with Perl > and Perl data structures. > > I am currently seeking help and encouragement to squash the segfaults that > currently prevent the completion of the second feature. :-) > It took a lot longer than I had expected, but I finally completed the second feature listed above and released the first "alpha" release of C::Blocks <https://metacpan.org/pod/C::Blocks> today. It took a long time because ultimately I had to create my own fork of the Tiny C Compiler <https://github.com/run4flat/tinycc> that supports extended symbol tables. I released an Alien distribution <https://metacpan.org/pod/Alien::TinyCCx> with (what I believe to be a nearly complete implementation of) extended symbol table support late last week, and it seems to be passing its test suite decently well <http://matrix.cpantesters.org/?dist=Alien-TinyCCx+0.06> on a fair number of platforms. Alien::TinyCCx is doing particularly well on Linux and decent on Windows. I'm a bit annoyed it's not passing on Macs because it works on my Mac. That'll get fixed soonish, I hope. It's still rough around the edges, but it's surprisingly fast. I have a number of examples <https://metacpan.org/source/DCMERTENS/C-Blocks-0.01/examples> that might give you an idea of how it works. I am particularly fond of my "port" <https://metacpan.org/source/DCMERTENS/C-Blocks-0.01/examples/libobjmg.pl> of XS::Object::Magic <https://metacpan.org/pod/XS::Object::Magic>, which simply involved copying the top half of rafl's code from his Magic.xs <https://metacpan.org/source/FLORA/XS-Object-Magic-0.04/Magic.xs> file into a cshare block. I plan to write more about it on blogs.perl.org, so I would encourage folks to check there if interested. David