lua-users home
lua-l archive

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


Hi!

I just failed to compile and use LPeg on my system. Compilation of the
DLL works (giving only an insignificant warning when assigning a
lua_Number to an int), and require-ing the module as well.

I've run the test.lua after that which crashes on line 489.

The only interesting thing I've done is compiling Lua and LPeg by
myself as C++ code. Both are generated with similar Makefiles (same
compiler options at least).

Any ideas are welcome...

For your information: I used the compiler coming with Visual Studio 2008.

Some more detail, FWIW...

This is the Makefile I used:

MOD = lpeg
DLL = $(MOD).dll
INCL = /I "..\lua-5.1.4"
MANIFESTFILE = $(DLL).manifest
CFLAGS = /TP /Ox /GL $(INCL) /D _CRT_SECURE_NO_WARNINGS /EHsc /MT /Gy
/W3 /c /nologo
LFLAGS = /LTCG /NOLOGO /OPT:REF /OPT:ICF /MANIFEST /MANIFESTFILE:$(MANIFESTFILE)
LUADIR = ..\lua-5.1.4
LUALIB = $(LUADIR)\lua.lib

all: $(DLL)

$(DLL): $(LUALIB) $(MOD).obj $(MOD).def
       link /OUT:$@ /DLL /DEF:$(MOD).def $(LFLAGS) $(LUALIB) $(MOD).obj
       mt /nologo /outputresource:"$(DLL);#2" /manifest $(MANIFESTFILE)

.c.obj:
       $(CC) /c /Fo$@ $(CFLAGS) $<

This is the error message when lua.exe crashes (it's a german XP, but
you'll get the point):

lua.exe - Fehler in Anwendung
Die Anweisung in "0x100098a9" verweist auf Speicher in "0x00448950".
Der Vorgang "written" konnte nicht auf dem Speicher durchgeführt
werden.

This is an excerpt from test.lua generating the error (slightly
modified, last line crashes):

t = {}
s = ""
p = function (s1, i) assert(s == s1); t[#t + 1] = i; return nil end
s = "hi, this is a test"

e = ((p - m.P(-1)) + 2)^0
m.match(e, s)

Regards,
Matthias