lua-users home
lua-l archive

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


> I have a really annoying dll problem. I have a C function inside my
> dll which I’m calling from Lua. Everything goes just fine unless Lua
> is using more memory than current threshold is before calling C
> function. In C function garbage collection makes the application
> crash. If I make Lua collect garbage before calling C function
> everything goes fine but if I try to collect garbage in beginning of
> C function everything crashes. I debugged what happens when I try to
> do garbage collection in start of C Function:

Make sure that there is only one incarnation of both Lua and the runtime
library around in your app and all dll's it uses.  The simplest way to do
this is to place all Lua runtimes (lua core and aux libs) in a lua.dll and
link your application and all your dll's (including lua.dll) against the
dynamic runtime library (msvcrtXXX.dll)

These kinds of problems are typically caused by mixing dynamically and
statically linked runtime libraries or using statically linked runtimes is
more than one instance (exe, dll).

--
Wim