tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] TCC: Best way to release functions that has been comp


From: David Mertens
Subject: Re: [Tinycc-devel] TCC: Best way to release functions that has been compiled in memory?
Date: Wed, 1 Jan 2014 19:42:09 -0500

Wuzhen (guessing by your latinized email address) -

Probably the best way to free compiled, relocated, jit-ed machine code is to provide your own memory allocation for it. This lets you free the memory when you're done with it. If you call tcc_relocate(state, NULL), the return value will be the amount of memory that needs to be allocated in order to relocate the code. Just malloc() that memory and pass a pointer to that memory in tcc_relocate: tcc_relocate(state, my_mem).

At least, that's my understanding of how it *should* work. :-)

David


On Wed, Jan 1, 2014 at 7:25 AM, 武振伟 <address@hidden> wrote:
Hi!
I'm working on making a script interpreter, and find TinyCC is just for me. Compiling string into a function pointer is really cool! But I wonder if there's a way to release those functions? Because there may be a lot of functions, and some may change and must be recompiled for many times. I think I can't just keep all these in memory. What should I do? I know I can compile them into DLL, but it seems not as convenient as compiling in memory. Are there other ways to solve this?


Sorry for my English. thx


_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel




--
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan

reply via email to

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