Closed kitlith closed 7 years ago
Do you mind making a pull request for this?
No, I don't mind. I didn't make a request initially due to me just hacking it about. I should get it together in a 'few' minutes.
... More than a few, I guess.
I set out to do it "properly" using a class constructor and destructor. "Why is this segfaulting?" pokes around with gdb "Hold on, why is 'tcc' 0?" pokes around some more "Okay, it's definately being set, but by the time it gets over here it's 0... is something else setting it?"
tcc = 0;
Oh. So much for that. (also: memory leak, much?)
I'll make a PR that applies my original fix, and then look into reusing the TCCState object.
At least, as of later TCC versions... In
tests/libtcc_test.c
This is currently not done, and results in errors like:
EDIT: Forgot to mention a way of getting it to work. In TCC.h, instead of calling
tcc_new()
iftcc
doesn't exist, I created a functioninit()
that callstcc_new()
and callstcc_set_output_type()
for you, and called that.