More programming and lots of progress in that regard.
The main Unity plugin is just a dynamic wrapper that loads up my “actual” DLL and binds the addresses to some statics, then the local exposed functions just forward those calls to my actual DLL. Other than that I have the Lua JIT compiler working alongside the ASMJIT library which allows me to mix the two actually. I can dynamically create functions in the ASMJIT library that seamlessly bind with LUA JIT. You just have to take care of pairing the parameters manually in assembly to have it fit with the LUA context.
Take this little block of lua and assembly for example.
code = [[
mov esi, [esp+4]
call @lua_getopt # number of arguments returned is in eax
# grab the return value from eax and do something with it
# do something with the parameter.
# . . .
# . . .
# some other things
push eax # assuming your computation results are stored there
mov eax, 1 # the number of arguments returned from this function.]]
— The ASMJIT can be used to convert that block to actual machine code and give it the correct function signature. Take the pointer to that binary data from ASMJIT and pass that into lua_register as a function pointer that lua can actually call.
test = asmfunction(code) — would go through all the steps above.
test(2) — would go through the lua registry and call the newly assembled function.
So, not only is LUA JIT very efficient and fast, but being able to dynamically assemble functions on the fly through a scripting language is quite cool to me. And this approach has almost no overhead. And if I introduce some safety blocks and fences with threads and processes, ZMQ will allow me to communicate between those blocks quite efficiently as well.
But, I am working on more things for my little command shell along with this. It is printing strings and results from lua and some simple assembled stuff, but I need to get most of the functionality of shell working as well.
More of this tomorrow.