lua-users home
lua-l archive

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

Am 21.09.2016 um 12:15 schrieb Jerome Vuarand:
C runtimes are not just a bunch of clean C functions using only stack
memory. Some might expect their main wrapper to have been called to
initialize some globals and will break if the exe was linked to
something else. Some might use thread-local storage in different ways,
and overwrite each other's memory.

Please see my mail titled "Mixing CRTs on windows" in this thread regarding that. While it may be true for other systems, at least on Windows, multiple CRTs have to be prepared for side-by-side loading (although I have verified that only for MSVC. It might indeed be different for MinGW).

> But even with two nice and clean runtimes, the Lua 5.3 API has a FILE*
> in luaL_Stream (I was under the impression that older Lua version had
> some FILE* too, but I can't find them now). If your program creates
> some of these, or if binary modules access some of Lua's own streams,
> you need to make sure every party involved agree on what FILE*
> pointers point at.

That is right. If you use luaL_Stream, then you need to use the same CRT.

I agree that mixing CRTs is a bad idea, but technically it should work for Lua on Windows (except for luaL_Stream, environment variables and locales).

‒ Christian