I did'nt encounter any problem when use lfs for lua5.1 under windows.
maybe you can use the "Depends viewer" of VC6 to make sure the dll
export luaopen_lfs() correctly.
----- Original Message -----
Sent: Tuesday, February 13, 2007 8:03
AM
Subject: Problems linking LuaFileSystem
module on Windows.
I recently found myself needing to insert a standardized header
comment block into 1300+ lua scripts. This seemed like a great use for
Lua and an opportunity to try out the LuaFileSystem module from LuaForge so
that I could dynamically iterate over the scripts in a directory.
Unfortunately, I've spent a few days wrestling with getting the module to load
into a script with the require() function instead. Initially this had to
do with incompatibilities between the LuaFileSystem pre-compiled dll and Lua
5.1, which I'm using. Rather than switching back to 5.0, I figured I'd
recompile the dll for Lua 5.1.1, which I succeeded in doing. When I try
to require the resulting dll, however, I get the following
error:
error loading module 'lfs' from file
'C:/lua/5.1/lib/lfs.dll': The specified
procedure could not be found.
My LUA_CPATH is
"./?.dll;C:/lua/5.1/lib/?.dll;C:/lua/5.1/?.dll" and the lfs.dll is compiled
using the Visual Studio Win 32 console dll template to extern the
luaopen_lfs() function (the function is preceded by
"__declspec(dllexport)"). At the moment, I'm just trying to get the
module linking to work, so I've commented out all of the code except a single
function, "foo" which just returns 0, the luaL_reg list ("fslib") containing
nothing other than foo and the sentinel entry, and the luaopen_lfs()
definition which calls luaL_register( L, "lfs", fslib ) and then returns 1.
The test script contains only:
require
"lfs"
I'm not familiar with compiling dlls, so I'm not sure whether the
problem is with that or if there's something about the syntax for the module
definition and the use of require that I'm missing.
Has anyone else
run into this error and fixed the problem? Or does anyone have a sense
of what's going wrong?
Thanks. -Link
-- Link
Hughes Lead Programmer 1st Playable Productions http://www.1stplayable.com
|