enigma-devel
[Top][All Lists]
Advanced

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

Re: [Enigma-devel] crashes on linux gcc exception handling


From: Daniel Heck
Subject: Re: [Enigma-devel] crashes on linux gcc exception handling
Date: Sun, 24 Sep 2006 19:55:33 +0200
User-agent: Thunderbird 1.5.0.5 (X11/20060728)

Ronald Lamprecht wrote:
> Hi,
>
> Daniel Heck wrote:
>>> 2. switch Lua to C++ for Linux and other OS, too
>>>
>>> As approach 1. means a lot of work and would force a rewrite of all
>>> tolua based code I would prefer the second solution.
>>>
>>> Is anyone aware of other solutions? Does anyone object solution 2?
>>
>> I think this would be a reasonable solution for the moment, although I'm
>> not sure that this is safe from Lua's perspective.  For example, I'm not
>> sure that this couldn't lead to memory leaks in the Lua interpreter, or
>> leave the Lua interpreter in some inconstistent state.
>
> As we release the Lua interpreter as part of the level abortion we
> should not run into trouble. You can test the fix by configuring the
> current revision with option "--enable-cxxlua".

Ah, I see.  I also hadn't noticed that Lua is configured to use C++
exception handling instead of the usual longjmp when it is compiled as C++.

>> It doesn't solve another problem: Lua scripts still don't have a chance
>> to handle errors raised in the Enigma engine.  A better (long-term)
>> solution might therefore be to map C++ exceptions to "lua_error" or
>> luaL_error calls.   I don't think that this is an urgent issue at the
>> moment, and I'm not sure that tolua would support this, but it's
>> certainly something to think about.
>
> Does any Lua support exist for catching Lua-error calls from within Lua
> code?

Yes, you can use pcall() to do this.  "Programming in Lua" has a very
good description of this topic (and most others).

- Daniel





reply via email to

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