OSX memory patch source example https://github.com/istarkov/lua_osx_allocator On Tue, Jan 21, 2014 at 8:13 PM, ivan starkov <istarkov@xxxxxxxxx> wrote: > Yes it works for me, (but it depends on library loading order etc of your > 64bit app) > i've wrote my own realization of mmap and munmap which used preallocated > memory block in low memory (algorithm is some kind of kernighan and ritchie > malloc free). > Patched luajit lj_alloc.c to use my mmap and munmap > and now all works fine on OSX > > > On Tue, Jan 21, 2014 at 7:53 PM, GrrrWaaa <grrrwaaa@xxxxxxxxx> wrote: > >> Curious… did it work? >> >> I would love to be able to use LuaJIT in a plugin (for a 64-bit app that >> I can’t patch). >> >> On Dec 25, 2013, at 2:49 PM, ivan starkov <istarkov@xxxxxxxxx> wrote: >> >> > I found this article >> http://hacksoflife.blogspot.ru/2012/12/integrating-luajit-with-x-plane-64-bit.html >> > >> > It looks like i can mmap memory blocks in this interval [0x10000, >> 0x80000000] on host app startup, and patch luajit. >> > >> > patch: >> > at lj_alloc.c >> > this functions: >> > rewrite CALL_MMAP and CALL_MUNMAP to use previously allocated regions. >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > On Tue, Dec 24, 2013 at 10:46 PM, Coda Highland <chighland@xxxxxxxxx> >> wrote: >> > On Tue, Dec 24, 2013 at 10:39 AM, ivan starkov <istarkov@xxxxxxxxx> >> wrote: >> > > On MacOs X luaL_newstate() always return NULL if called from >> dynamically >> > > linked plugin (dlopen). >> > > >> > > No effect if i set -pagezero_size 10000 -image_base 100000000 on main >> > > executable, and make plugin rebase >> > > rebase -low_address 150000000 libLuaPlugin.so >> > > >> > > Is it possible on Osx to use luajit from plugins? >> > > >> > >> > Long story short, the answer is "no." I dealt with the same issue a >> > year ago or so. I had to fall back to vanilla Lua and rewrite my FFI >> > code to use C API functions instead. >> > >> > I asked what it would take to make it compatible and apparently it's a >> > fairly deep set of changes that would be required. >> > >> > /s/ Adam >> > >> > >> >> >> >