[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: cleanup in a C module
- From: Mailing-Listen <list@...>
- Date: Wed, 23 Jun 2010 21:07:30 +0200
On Wed, Jun 23, 2010 at 01:45:48PM -0300, Luiz Henrique de Figueiredo wrote:
> > Now, the module needs some cleanup at the end. It does work when I export
> > a cleanup function, named "avt.quit()", and the script calls this function
> > at its end. So far so good. That works.
> > But it breaks, when the script doesn't call that function, for example
> > when there is an error in the script, or someone forgets to call that function.
> > So what I'd like to have is that a function is called automatically when
> > the script ends - whether it ends with an error or at a normal end.
> If you're embedding Lua then call the cleanup function manually from C
> when the script ends.
Okay, I already do that. And it works with atexit, when I call the lua script
from the C program.
> If you're using the standard Lua interpreter,
> you can do the same if you run your script from a wrapper script.
Do you mean a lua program as wrapper? That would not be better than the C
program I already have.
Or do you mean a wrapper module? Well, that might work, but that would be
an extremly dirty workaround. And I don't like that.
So I think, it is best when I just leave the module away and only release it
with the program.
Thanks for your answers.
By the way, is it okay when I announce the final release on this mailing list?
(But it is still some work to do... There is no documentation, yet.)