[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Loading dynamic libraries on Windows
- From: Georg Lehner <jorge-lua@...>
- Date: Sun, 06 Nov 2011 16:45:35 +0100
I just found another detail to add to the excelent discussion in:
As reported earlier on the list I had problems with loading "mime.core" and
"socket.core", while loading them individually worked without problems.
The explanation can prominently be found in the Microsoft documentation
the Windows CE/Windows Mobile API:
"..Two different modules cannot have the same file name, even if the
are different. These effectively have the same module name. For
LoadLibrary is made on Sample.cpl, the operating system will not load
Sample.cpl, but instead will again load Sample.dll. .."
My current solution modifies "findfile()" in loadlib.c by giving it a third
parameter "namesep", which is used to replace dots (".") in module names
handing it over to the path template.
When searching plain Lua modules (LUA_PATH_DEFAULT), "namesep" is set to
"LUA_DIRSEP" just as usual. However When searching C modules
the preprocessor macro LUA_CNAMESEP (invented by me) is used as
"namesep". I set
this to the underscore character ("_") which gives me the clearly
filenames mime_core.dll and socket_core.dll.
A similar approach is used by Microsoft for their .Net Compact Framework
of separate directories for .Net .dll's in the GAC).
This approach would also help with (while not resolve) some of the
on the LoadLibrary Wiki page.