[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] libtcc API v.s. global state v.s. tcc state
From: |
grischka |
Subject: |
Re: [Tinycc-devel] libtcc API v.s. global state v.s. tcc state |
Date: |
Sun, 20 Apr 2008 20:10:25 +0200 |
From: "egodust":
> My version of tcc_export_binary_image() just *moves* the pointers
> inside the state structure into the "binary" structure, tcc still owns
> the memory, thats why *free() is needed, tcc_free() doesn't deep free
> and tcc_delete() only works on TCCState objects.
Ah, okay. I thought you wanted to copy all the section data into one
single piece of flat memory, like:
|<----text----><--data--><---bss--->|
This to free is plain easy. It is (moderately) more complex to
make, though.
As to your patch, fine, but it still raises a question: Why do we
move sections into a new structure TCCBinary plus need an extra
destructor, instead to just keep TCCState itself and use tcc_delete
as it's meant to work obviously?
Okay, there is some global data that we must clear before we can
do another compilation, and this happens in tcc_delete currently,
so we need to call tcc_delete before we can create a new state.
But I mean, it doesn't need to be like that. We could as well clear
the global data from elsewhere, so we can do new compilation, and
still can run old states.
What do you think?
--- grischka