lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


To follow up on my own request:

Following the insight from David Burgess and Mike Pall (thanks, guys!), I did manage to get the dynamic loading to work under cygwin. I'll pollute the mailing list archive with my notes in case there is some other wanderer as lost as I was when trying to get this to work under cygwin.

In the end, I ended up #defining LUA_DL_DLOPEN in luaconf.h, and in a very hackish way, modified the Makefile under the src directory to contain the new target

so: $(CORE_O) $(LIB_O)
  gcc -shared -o lua.so $(CORE_O) $(LIB_O)

After invoking make so, I hand-copied the shared object to the location specified under the prime Makefile. I should have modified the makefile to do that as well. Hmmmm...

My dynamically loaded library that I guinea-pigged was lfs; to get that to build, I had to modify its config file. I changed the following variables
LIB_EXT= .so
LIB_OPTION= -shared
WARN= -O2 -Wall
LIBS= -L$(LUA_LIBDIR) -llua -lm $(DLLIB)

after a quick make, launching lua, I typed the following
path='/home/Pimmel/luafilesystem-1.0/liblfs-1.0.so'
f=assert(loadlib(path,'luaopen_lfs'))
lfs=f()
for k,v in pairs(lfs) do print(k,v) end
dir     function: 0xa056a20
unlock  function: 0xa056910
_VERSION        1.0
currentdir      function: 0xa056958
_NAME   LuaFileSystem
mkdir   function: 0xa0568a8
lock    function: 0xa056a58
_DESCRIPTION LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution
_COPYRIGHT      Copyright (C) 2004-2005 Kepler Project
chdir   function: 0xa0568d0
attributes      function: 0xa056868
print(lfs.currentdir())
/home/Pimmel/luafilesystem-1.0
lfs.chdir('..')
print(lfs.currentdir())
/home/Pimmel

Thanks again for the help and insight. Sorry for a new subject; I receive the mailing list as a digest and didn't find a quick way to respond to the proper "thread" ...

Keith
--
Keith Pimmel     ~~~~     Dynetics, Inc.     ~~~~     256.964.4717