tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Using several instances of TCC?


From: achimdahlhoff
Subject: [Tinycc-devel] Using several instances of TCC?
Date: Sun, 03 Aug 2008 12:20:37 +0100

Hi all.


I just subscribed to the list because TCC is a very nice little compiler and I would like to use it... (-:

I have been trying to use TCC in a way to spawn several instances of it to be able to compile many small snippets of dynamically generated code. But it looks like TCC does not support this (anymore?).

Even though tcc_new and tcc_delete look like they keep all state info in the TCCState struct, there are global vars inside tcc.c which are deleted the first time I delete a TCCState. The next tcc_delete crashes.

I have looked into it a little and it does seem to be easy to sort this out without a good understanding of all the data structures...

Is there a way to compile and execute several snippets of code to memory without the need to put all in a single source? Is there maybe a way to extract the compiled code out of TCC and use the same instance for another source?

I would appreciate your help. I can also help out on the code if I know where to start. :-)  Is there a documentation on the internal data structures?


My application would be to use it for genetic algorithms: A simulator dynamically (randomly) creates code, compiles it and runs it. It should keep generated C-source and compiled block of code for each 'individual' and use it. When new individuals are spawned, they get a new piece of code which I want to compile using TCC without the need to recompile the others. Many such algorithms use interpreted code, but I want to use the speed of compiled code. Since several individuals might be spawned every second, a fast compiler not using any files would also be nice. :-)



Achim.

Sig1, form cont

reply via email to

[Prev in Thread] Current Thread [Next in Thread]