[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    C bindings with __gc
From:       Enrico Tassi <gareuselesinge () libero ! it>
Date:       2004-04-23 17:29:27
Message-ID: 20040423172927.GA29650 () garfield
[Download RAW message or body]

I've a little question about tolua(++) and other binding generators..

Consider a C++ class with a destructor. It is easy to use tolua to 
generate bindings that use the destructor putting it in the __gc field
of the metatable. nothing strange here.

Now consider the same situation in C, you can take the example of
Roberto in his book, the one with opendir and DIR*. we want to use 
closedir as the pseudo-destructor of the object representing the
directory handler. The book is really clean about what to do to by
hand. but doing all by hand makes it hard to keep up to date.

So the real question is: is there a way to tell tolua(++) that
we are working in C but we would like to add a "destructor" to our
usertype? and if tolua is not able to do this, maybe for a lack of
expressivity in the .pkg language, is there another binding generator
with these features?

Thanks
-- 
Enrico Tassi

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic