[prev in list] [next in list] [prev in thread] [next in thread]
List: lua-l
Subject: Re: Dynamic libraries with lua5.1w6 and cygwin
From: Keith Pimmel <keith.pimmel () dynetics ! com>
Date: 2005-05-30 5:47:33
Message-ID: Pine.WNT.4.62.0505300020190.452 () DYNETICS-B87A5D ! in ! dynetics ! com
[Download RAW message or body]
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic