[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANNOUNCE] bare-bones loadlib
- From: sessile@...
- Date: Fri, 22 Mar 2002 22:39:26 -0500
At 03:14 PM 3/22/2002 -0800, Eric Tetz <erictetz@yahoo.com> wrote:
>--- James Hearn <james.hearn@byu.edu> wrote:
>> Right this minute I'm working on compiling a completely native
>> dynamically loaded version of Lua and the loadlib test program using the
>> cygwin toolchain. I'm making progress. Wish me luck!
>
>Just for contrast, this is all easy to do with Borland C++ 5.5 (free).
>From the root of the Lua distribution:
<snip bcc32 build of lua.dll with and without loadlib support>
Modifying Eric's procedure to work with 'gcc version 2.95.3-5 (cygwin
special)' resulted in the following steps (well, it works for the example
at least):
>Extract the 'loadlib' tarball into '(lua distro root)\loadlib', then..
>
>Code changes:
>
>(1) Add the following line to include\lualib.h
>
> LUALIB_API int lua_loadlibopen (lua_State *L);
>
>(2) Add the following line to src\lua\lua.c : 'openstdlibs'
>
> lua_loadlibopen(l);
(3) There is no step (3)!
>(4) Change the 'loadlib' line in loadlib\test.lua to:
assert(loadlib(D.."/mylib.dll","mylib_start"))
>(5) Build everything:
gcc -mno-cygwin -shared -o lua.dll -I./include src/*.c \
src/lib/*.c loadlib/etc/windows.c
gcc -mno-cygwin -o lua.exe -I./include -L. -llua src/lua/*.c
gcc -mno-cygwin -shared -o mylib.dll -I./include -L. -llua \
loadlib/mylib.c
(6) Run it from Windows command prompt (no cygwin1.dll in PATH!):
C:\lua-4.1-work4dll\lua.exe loadlib\test.lua
Hello from mylib
Regards,
Dean.