Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there kind of runtime C++ assembler library around? [closed]

For my small hobby project I need to emit machine code from C++ program in runtime. I have base address 0xDEADBEEF and want to write something like this:

Assembler a((void*)0xDEADBEEF);
a.Emit() << 
  Push(Reg::Eax) <<
  Push(Reg::Ebx) <<
  Jmp(0xFEFEFEFE);

Inline assembler isn't my choice because generated machine code is dependent of the program state.

Does anybody know any existing library for doing this? If no, would it be a good idea to develop one from scratch and make it open source? (I mean, will anybody ever use this library if it existed?)

like image 254
Anton Avatar asked May 07 '10 07:05

Anton


1 Answers

Check out Asmjit. It seems to be the thing you're looking for.

like image 107
Taavi Avatar answered Sep 18 '22 00:09

Taavi