My name is David and I'm an avid Perl programmer. I also do numerical computing, currently mostly with PDL. I have known about TCC for some time but I only recently learned about libtcc. I am *very* interested in creating a Perl module that tightly integrates with libtcc so that I can use Perl's fast string processing to stitch together C functions, and then use TCC to compile them on the fly. I have begun playing with libtcc and I have a few questions.
Is tcc thread-safe? I've noticed a few places that care about the current compiler context (TCCState) and others that do not. Not a big deal, just curious.
Is tcc_add_symbol always necessary? I've noticed that I can define a function in my main program and apparently call it without calling tcc_add_symbol, but when I try to remove that line from libtcc_test.c, it croaks with undefined symbol issues. My current test case that raises this question is quite complex, so I can try to boil it down if that would help.
What are the best references for understanding the basic compile process? In particular, why is it necessary to relocate code? I suspect the "Dragon Book" would be a good starting point, but I figured I would check before diving into it.
Finally, assuming I get my head around the tcc core, how easy or difficult will it be for me to add Mach-O support? I know it won't be easy, but I just wanted to get an estimate as to how much of the code assumes ELF output.