lua-users home
lua-l archive

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


If my memory doesn't betray me, similar thing has happened to me. I was wrapping Lua API in a C++ class and added another member to lua_State as the very first member of that structure (just like I did in Lua 4). The app ran fine but would crash on exit in what seems to be the same piece of code. It occurred that GC relies on 'CommonHeader' being the very first 'member' of any structure it is used in. If not, GC would crash under most conditions.

AB

> -----Original Message-----
> From: Brett Kapilik [mailto:brett@indigorose.com]
> Sent: Thursday, March 06, 2003 8:22 AM
> To: Multiple recipients of list
> Subject: Lua 5.0 beta/loadmodule question
> 
> 
> This is a bit of a long shot, but I thought some of you Lua 
> gurus might be able to help...
> 
> I am using Lua 5.0 beta in a Win32 app (MFC).  I have been 
> using it for months with no troubles.  However, I want to add 
> loadmodule (the 12-18-2002 version from castanyo@yahoo.es) to 
> the project.  After a bit of manipulation to make 
> loadmodule.c to work in my project, I am pretty happy with 
> the results.  I can call module.load("MyModule") and it works 
> great.  I can call lua functions that get added from the DLL 
> as expected.
> 
> The problem is that if I call module.load during runtime, I 
> will always get an access violation when my application 
> exits.  The access violation occurs here (ltable.c):
> 
> /*
> ** search function for strings
> */
> const TObject *luaH_getstr (Table *t, TString *key) {
>   Node *n = hashstr(t, key);
>   do {  /* check whether `key' is somewhere in the chain */
> >>>> THIS LINE >>>>    if (ttisstring(key(n)) && 
> tsvalue(key(n)) == key)
>       return val(n);  /* that's it */
>     else n = n->next;
>   } while (n);
>   return &luaO_nilobject;
> }
> 
> Here is the call stack:
> 
> 
>