[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LoadLibrary usage reviewed / LfW
- From: Dimiter 'malkia' Stanev <malkia@...>
- Date: Wed, 19 Oct 2011 11:19:12 -0700
That's a very useful information on a much more broad scope than lua.
On 10/14/2011 6:46 PM, David Manura wrote:
Here's an analysis of LoadLibrary behavior in Windows builds of Lua:
http://lua-users.org/wiki/LoadLibrary . I've come to some possible
conclusions on how Windows builds such as LfW should be changed:
(A) Lua binary modules should have a unique DLL naming convention,
like "foo.luad" or "foo-lua.dll" rather than "foo.dll", to avoid
conflict with non-Lua DLLs. LUA_CPATH can be updated accordingly.
(B) Something maybe should be done about Lua 5.2.0-beta
LoadLibraryEx triggering undefined behavior  with
LUA_LLE_FLAGS=LOAD_WITH_ALTERED_SEARCH_PATH and relative paths like
package.cpath=".\\?.dll". A recommended approach is to make paths
absolute. This may be done via GetFullPathName, though it possibly
leads to corruption in multithreaded and shared library situations 
(why shared libraries???). Alternately, ".\\?.dll" could could be
removed from package.cpath, but the user might still try to add it.