[ZeroBrane Studio] Re: "Invalid access to memory location" with statically linked LuaJIT

  • From: Paul K <paul@xxxxxxxxxxxxx>
  • To: "zerobrane@xxxxxxxxxxxxx" <zerobrane@xxxxxxxxxxxxx>
  • Date: Wed, 11 Feb 2015 09:43:40 -0800

Hi Rasmus,

> I've got a LuaJIT source with LUA_API defined to __declspec(dllexport) in
luaconf.h
> Using that I created lua51.dll, then a proxy DLL of that using this:
http://lua-users.org/wiki/LuaProxyDllThree
> Then compiled LuaJIT statically and created my executable with that,
putting my proxy DLL in the same directory.

Your path setup looks correct, but you probably want to use DLL4 (
http://lua-users.org/wiki/LuaProxyDllFour), not DLL3, as you are creating
the proxy to forward the calls to a statically compiled library, not to a
different DLL (which is what DLL3 does).

Basically, you'll have your executable with LuaJIT statically compiled in
AND you will have lua51.dll in the same folder as your executable, which is
going to be a proxy dll (DLL4) that will proxy/forward requests for Lua API
to LuaJIT functions compiled into your executable. See this link (
http://lua-users.org/lists/lua-l/2013-11/msg00831.html) and related
discussion for some details on this topic.

Paul.

On Wed, Feb 11, 2015 at 4:21 AM, Rasmus Riiner <rasmus.riiner@xxxxxxx>
wrote:

> I've got a LuaJIT source with LUA_API defined to __declspec(dllexport) in
> luaconf.h
> Using that I created lua51.dll, then a proxy DLL of that using this:
> http://lua-users.org/wiki/LuaProxyDllThree
> Then compiled LuaJIT statically and created my executable with that,
> putting my proxy DLL in the same directory.
>
> I've go the latest version of ZBS all open and ready to roll with the
> debugging server running.
> Now run this code from my executable:
>
> local folderPath = "D:/Pro/ZeroBrane"
> package.path  = package.path ..";"..folderPath.."/lualibs/?.lua"
> package.path  = package.path ..";"..folderPath.."/lualibs/?/?.lua"
> package.cpath = package.cpath..";"..folderPath.."/bin/clibs/?.dll"
> require('mobdebug').start()
>
> Aaaand get:
>
> error loading module 'socket.core' from file
> 'D:/Pro/ZeroBrane/bin/clibs/socket\core.dll':
>     Invalid access to memory location.
>
> Extensive googling hasn't helped.
> Wat do?
>
>
>

Other related posts: