Milutin, all -
Yes, you were absolutely correct. Once I recompiled tcc as a shared
library, the issue went away. That lesson has been learned. :-)
However, my main question remains unanswered, and my suspicions have
been confirmed with new tests. To recap, here is my original question:
Is there a good reason symtab_section is a global variable? In
addition to the issue that I encountered, what if I want to have
multiple compiler states? It looks to me like the pointer for
symtab_section will be overwritten for each call to the constructor.
Won't this lead to trouble? And is there any reason we don't have a
field in the TCCState struct to store the location of symtab_section?
Whether or not this is the source, I have indeed encountered issues
under a few circumstances:
1) Using a single compiler state, compiling+relocating multiple times.
When I do this, I cannot call any functions from the first relocation
after the second relocation.
2) Using two states, I cannot call any functions from the first state
after I have compiled+relocated the second state. Using the *first*
state, I *can* retrieve symbols from the compilation of the second state!
So, it looks like there's a global variable for some sort of symbol
table machinations.
Thoughts?
David