lua-users home
lua-l archive

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

I've done this in the past as:

1.) write assembler and compile to an object file using NASM
2.) have the assembler append a jump table of dd/q offset
3.) write a c-stub which calls address at offset 
4.) call c-stub in lua with named constants for offsets 

You can as an exercise write a preparser which extracts online asm and replaces them with the index calls. 

Generally it is easier to write C with online assembler and glue into the lua global space. In my case I already had the bin. 

-=-=- -=-=-

On Jan 4, 2011, at 7:00 AM, beo wulf <> wrote:

> Note: I don't want LuaJit
> I'm on x86_64 , ubuntu linux.
> I want to be able to, in lua, write assembly code,
> which the library then assembles, registers with the lua vm,
> which I can then call into.
> Are there any libraries that make this possible?
> Note: I don't want LuaJit. I want to generate the assembly instructions myself.
> The goal here -- if I can do this, then I don't need to write most of
> my code in C++ and then do all this bridging -- I can even write the
> compute intensive parts in lua.
> Thanks!