lua-users home
lua-l archive

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


Here's my specific problem - 

void lua_error (char *s)
{
  if (s) message(s);
  if (L->errorJmp)
    longjmp(*((jmp_buf *)L->errorJmp), 1);
  else {
    fprintf (stderr, "lua: exit(1). Unable to recover\n");
    /* exit(1); */
  }
}

if you remove exit() and return from this without stopping execution,
calls to lua_error from places like luaD_checkstack -

      if (lua_stackedfunction(100) == LUA_NOOBJECT)  /* 100 funcs on
stack? */
        lua_error("Lua2C - C2Lua overflow"); /* doesn't look like a rec.
loop */
      else
        lua_error("stack size overflow");
    }

cause stack overflow exceptions on the c side.  I can't allow Lua to
call exit()
because i need the execution thread to unwind so i can use it to clean
up 
things like OpenGL. 

Does this make sense? Maybe i'm the one missing something?

Regards,
Jim




-----Original Message-----
From: Luiz Henrique de Figueiredo [mailto:lhf@tecgraf.puc-rio.br]
Sent: Monday, August 28, 2000 7:23 AM
To: Multiple recipients of list
Subject: RE: exit


>We had the same problem with our embedded app.  I reworked the
>alert a little and removed the exit call, replacing it with a 
>flag i check in a few key places to force the execution thread to 
>unwind and exit from my initial dobuffer call.

I must be missing something, but why do you need to change the C code at
all?
Simply redefining _ALERT to be a (even C) function would do, wouldn't
it?
--lhf