[fpc-pascal] LuaJIT 2 crashes under FPC+Win64. SEH issue?

denisgolovan denisgolovan at yandex.ru
Sat Mar 2 11:42:02 CET 2013


Hi all

Currently I am trying to make work attached code under Win64.
It uses LuaJIT 2 as drop-in replacement to Lua.

The code works fine under Linux32, Linux64, Win32, but not under Win64.
Under Win64 it crashes with unhandled exception like following:

An unhandled exception occurred at $0000000077D67D9D:
EControlC: Control-C hit
  $0000000077D67D9D

The same dll works fine under gcc/msvc complied project (luajit.exe interpreter which comes in box).

The idea of the attached code is following:
- try to calculate _invalid_ Lua code
- return Lua error (not exception).

The problem seems to have something to do with exception handling under Win64 as LuaJIT 2 using native exceptions in its dll.
But it does not mean that C exceptions should be catched by FPC.  I understand that's not possible.
lua_pcall should handle those internally (like under Linux64).

It looks like some issue in FPC prevents LuaJIT catch its own exception under Win64.

P.S. Tested under FPC svn rev. 23910
P.P.S. You can use https://github.com/malkia/ufo/blob/master/bin/Windows/x64/luajit.dll LuaJIT build under Win64. Just rename it to lua5.1.dll to comply with lua.pas.

-- 
Regards,
Denis Golovan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: project1.lpr
Type: text/x-c++
Size: 619 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130302/583cdaa1/attachment.bin>


More information about the fpc-pascal mailing list