lua-users home
lua-l archive

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


On Feb 04, 2002 at 08:59 +0100, Ignacio Castaño wrote:
> Thatcher Ulrich wrote:
> > > I've uploaded here a first version of the addon here:
> > > http://talika.fie.us.es/~titan/lua/
> >
> > I couldn't wait to start hacking on this... I made some binaries to
> > demonstrate the module concept, using my existing luaSDL binding.  You
> > can get them here:
> >
> > http://tulrich.com/geekstuff/files/luaSDL.zip
> 
> Hey, that's really nice!

Thanks!

> I was going to write a simpler example, but with my exams was not having
> enough time to do so. I've seen you have separated the lua vm and the lua
> executable to avoid memory allocation conflicts. Is that also necesary on
> *nix or only in win32?

Not sure -- I started on Linux, and ran into core dumps, and flailed
around trying to fix it, but only later commented out the Lua API
calls to register the library handle.  So possibly it's not necessary?

On Win32, I don't think the issue is memory allocation (as long as you
use the MSVCRT C library, which is thread and DLL aware I think).  The
issue is that DLL's that call the Lua API won't be able to see the Lua
code in the core .exe, but they will see it if it's a DLL.

> > * I had to comment out the part of Ignacio's code which registers some
> >   library info in a Lua table -- it was causing crashes on both
> >   platforms.  So use()'ing a library more than once may create
> >   problems!
> 
> I think you are using an old version, I updated it in a short time after the
> first release, but accidentally replaced it again with the older version.
> Now the right version is up, and I think the problems are gone, please tell
> me if I'm wrong.

I used the old version (I think) on Linux, and the new version on
Win32, and ran into seg faults in both versions.  I didn't dig into
the problem to find out why; I was just trying to get something up
quickly, so it could have been any number of other problems.

> I'm also going to write a template project to facilitate binding the
> libraries with the lua library. Usually libraries are just .lib or .a files,
> so the template only has to bind lua dynamically, and to call the
> initialization functions of the libraries, that can be specified through
> macros. The template would bind the original library, and produce a dynamic
> library to use with lua 'use' addon. I think that should facilitate porting
> libraries to the new system.

Yeah, that sounds good.

> > That .zip includes both Linux and Win32 binaries, and a little sample
> > SDL game written in Lua.  I'm including the README from that zip file
> > below.
> 
> However, the linux binary is missing.

Drat!  I just updated it.

Another observation: the Lua core makefiles are *almost*
nmake-compatible; all they really need is the definition of macros to
change the file extension conventions (use .obj instead of .o, .lib
instead of .a, etc).  One approach to a "more universal" core Lua
distribution would be to add those macros, and then have a
"config.win32" or instructions for Win32 folks, so they could compile
with "nmake".  I guess this could be a PowerPatch.

-- 
Thatcher Ulrich <tu@tulrich.com>
http://tulrich.com