lua-users home
lua-l archive

Re: Lua C API can't be used from other languages without C wrappers

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


On 2018年02月18日 12:39 PM, Dirk Laurie wrote:
2018年02月18日 17:23 GMT+02:00 Soni "They/Them" L. <fakedme@gmail.com>:
It was recently brought to my attention that the Lua C API is strictly a C
API, and not as universal as some ppl claim it to be.[1]
It works perfectly with Free Pascal too.
http://lua-users.org/wiki/LuaInFreePascal
More specifically, it's unsafe to directly call this API from any sort of FFI!
This includes LuaJIT FFI, Python CFFI, any of the many FFI wrappers for Java, and so on!
Would not that be more a defect of the FFI than of the Lua API?
What happens if you "pcall(C.lua_error(some_L))" from within LuaJIT? does the pcall catch the lua_error? are the results the same between windows and linux? etc. I seriously doubt it's a defect of the FFI. There's only so much an FFI can (or should) do, and handling all forms of unwinding, including setjmp/longjmp *and* C++ exceptions *and* the OS's exception propagation mechanism, is not one of them.
--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.

AltStyle によって変換されたページ (->オリジナル) /