Is there a C ++ assembler assembly runtime?

For my small hobby project, I need to release machine code from a C ++ program at runtime. I have a base address of 0xDEADBEEF and you want to write something like this:

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

The built-in assembler is not my choice, because the generated machine code depends on the state of the program.

Does anyone know of any existing library for this? If not, would it be nice to develop it from scratch and make it open source? (I mean, will anyone ever use this library, if it exists?)

+7
c ++ assembly runtime
source share
3 answers

You can use Nicolas Capen softwire . He was not really supported, as he is now working on a similar product in Transgaming called SoftAsm. However, this is similar to what you want.

Edit June 2014 : - It looks like the sourceforge link above has been removed, but it seems to be available under the LGPL license here .

+3
source share

Check out Asmjit . This seems to be what you are looking for.

+7
source share

It can be overkill because it supports many platforms, has its own intermediate language, does optimization, etc., but http://llvm.org/ seems to be an attempt by God.

+3
source share

All Articles