Hi.
I tried to use some additional lua-modules on windows e.g. with: require 'winman' It seems that the correct path to the module has to be added to LUA_CPATH (can be done with package.cpath) for "require" to work. But then the loaded module looks for lua51.dll. Some default behaviour I guess. I copied libgeanylua.dll as lua51.dll to Geany's program directory and that seems to do the trick. Apparently libgeanylua sees Geany's program directory as its working directory? Is there a better way to do this? Maybe a modification to libgeanylua?
Andreas Mokros am@medienpensionat.com wrote:
I tried to use some additional lua-modules on windows e.g. with: require 'winman'
Cool.
It seems that the correct path to the module has to be added to LUA_CPATH (can be done with package.cpath) for "require" to work.
That's true for all Lua programs, no?
But then the loaded module looks for lua51.dll. Some default behaviour I guess.
hmmm... I never actually tried loading modules on Windows, it works fine on Linux. But I see now where it would be problematic.
I copied libgeanylua.dll as lua51.dll to Geany's program directory and that seems to do the trick.
hey, that's pretty clever, but I'm not sure how having two DLL's referencing identical code from two different places will work out in the long run. Seems like it might cause some unexpected behavior somehow.
Apparently libgeanylua sees Geany's program directory as its working directory?
I think this has to do with the way Windows resolves DLL references - it looks first in the application directory, then in the windows system directories, then in your %PATH% (I'm not sure if that's the exact order, but you get the idea.)
Is there a better way to do this? Maybe a modification to libgeanylua?
The problem is that geanylua links statically to 'liblua.a' but in order to load modules on Windows, it must (???) be re-compiled to link dynamically to lua51.dll instead. Then you would of course need to put the "real" lua51.dll some place where windows can find it.
That shouldn't require any change to the geanylua sources, just a change in the build environment so the linker will pick up on the shared library instead of the static archive.
My windows box still has a pre-0.14 version of Geany, so I don't know how well this will work with whatever version you are running, but you can try them if you want:
http://yetanothergeek.fileave.com/geanylua-dyn-dlls.zip
You will also need the "lua5_1_3_Win32_bin.zip" package from http://luaforge.net/projects/luabinaries/ in order to get the shared Lua DLL's.
Thanks for you feedback!
- Jeff