[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJIT 2 ffi (casting / force hotpath)
- From: Alex Bradbury <asb@...>
- Date: Fri, 21 Jan 2011 11:12:58 +0000
On 20 January 2011 21:23, Mike Pall <mikelu-1101@mike.de> wrote:
> I hope the docs clear up many of your questions. If not, then
> please ask here. Feedback welcome!
I can imagine binding C APIs by creating Lua objects that hold a
reference to the C object. If the library lets you allocate the memory
yourself, then garbage collection can be handled for you. Otherwise
just the pointer cdata will be gced, so you must write your own __gc
metamethod to call the library's free function - but this isn't
supported on tables. Is there a better way than creating a newproxy
for each object and giving it a __gc metamethod that makes the
appropriate free call?
Alex