Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-03

LuaJIT 2 crashes under FPC+Win64. SEH issue?

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

denisgolovan

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

Reply by email

Reinier Olislagers
to denisgolovan
denisgolovan wrote 23 lines
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.

Yep, it seems like issue is exception handling (similar to issue http://bugs.freepascal.org/view.php?id=21581
etc)
Try compiling FPC with -dTEST_WIN64_SEH and try again...

To the devs: any news about Win64 SEH code progress?

Reply by email

denisgolovan
to Reinier Olislagers

Thanks a ton.
Building FPC with -dTEST_WIN64_SEH makes the trick!

02.03.2013, 14:47, "Reinier Olislagers" :

Show quoted text 12 lines
On 2-3-2013 11:42, denisgolovan wrote: Yep, it seems like issue is exception handling (similar to issue http://bugs.freepascal.org/view.php?id=21581 etc) Try compiling FPC with -dTEST_WIN64_SEH and try again... To the devs: any news about Win64 SEH code progress? _______________________________________________ fpc-pascal maillist  -   http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Regards, Denis Golovan

Reply by email

Reinier Olislagers
to Marco van de Voort
Marco van de Voort wrote
In our previous episode, denisgolovan said: > Building FPC with -dTEST_WIN64_SEH makes the trick! Hmm, maybe it is slowly time to make this defau

Or quickly ;)

Last I heard about it was in July 2012:

Perhaps some improvements were made meanwhile?
(As for issue 1 in that post: doesn't Windows use a native linker nowadays?)

Thanks,
Reinier

Reply by email