[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LoadLibrary and 5.2
- From: Peter Cawley <lua@...>
- Date: Tue, 12 Jan 2010 13:43:20 +0000
On Tue, Jan 12, 2010 at 1:17 PM, David Burgess <firstname.lastname@example.org> wrote:
> So your issue is with package.loadlib rather than require() ?
I do not think so.
Assume that we are distributing some executable which uses LuaCURL,
and loads it via require"curl". One could distribute all the required
files alongside each other:
my-app/curl.dll (the Lua glue around the CURL library)
my-app/libcurl.dll (the actual CURL library, placed in a separate DLL
due to being a different license)
Say that one wants to move Lua extension DLLs to their own directory.
It would be nice to add the extensions directory to package.cpath, and
then do something like:
However this will not currently work. require"curl" will find
my-app/extensions/curl.dll, but curl.dll depends upon libcurl.dll, and
the Windows DLL loader has no knowledge of package.cpath, so it will
try (and fail) to load my-app/libcurl.dll (as the default DLL search
order looks in the directory of the EXE, rather than the directory of
the dependee DLL being loaded). For things to work, either
LOAD_WITH_ALTERED_SEARCH_PATH needs to be used, or dependant DLLs
would need to be placed in my-app/ rather than my-app/extensions/.