[Cuis-dev] VM crash when trying to interface to LuaJIT (Access Violation Exception)

Michał Olszewski m.olszewski at nexat.pl
Sat Jun 12 05:55:06 PDT 2021


Okay, so I did a few tests and it seems like using pragma send fixes it 
all.

Also, it seems like call to "luaL_newstate" always returns the same 
address, yet Lua states are clearly separated/new. I'm really confused 
by that. Shouldn't they have different addresses? Probably a Lua thing.

It seems like I've been too hasty to call for help.

Just a last question, out of curiosity, why call via 
ExternalLibraryFunction(name:module:callType: ...) crashes VM but not 
via pragma send(<cdecl: ...>? What does pragma do different than the 
other one? "tryInvokeWithArguments" message also causes crash.

W dniu 2021-06-11 o 17:44, Michał Olszewski via Cuis-dev pisze:
> Hello,
>
> I'm new to the list. I've been messing for some time with Squeak but I 
> found it too bloated, so I decided to switch to Cuis since it's "lean 
> and mean" and this really helps learning Smalltalk (or anything in 
> general...). I'm having my own goals and for this I need to interface 
> to Lua, specifically LuaJIT.
>
> The problem is that VM crashes, with Access Violation Exception, when 
> it tries to create new Lua state via FFI. It seems like it only 
> happens when I call it from Cuis. I tested it by compiling standalone 
> C application with the call and it works fine.
>
> I'm invoking 'luaL_newstate' via FFI's ExternalLibraryFunction, not 
> via pragma send. The prototype that appears in debugger is: 'cdecl: 
> CLuaState* 'luaL_newstate'() module: 'lua51'. "CLuaState" is the dummy 
> struct representing "lua_State".
>
> Some extra info: OS is Windows 8 64 bit; VM, image and lua51.dll is 64 
> bit; DLL has been compiled using MSVC via vcpkg package manager (maybe 
> it's the compiler's issue?).
>
> I could attach crash dump but I'm not sure if it will be any helpful.
>
> I wrote a bit too long post but I tried to provide as much info as 
> possible.
>


More information about the Cuis-dev mailing list