是否有一种运行C ++库汇编周围? [英] Is there kind of runtime C++ assembler library around?

查看:116
本文介绍了是否有一种运行C ++库汇编周围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关我的小爱好的项目,我需要在运行时从C ++程序发出机器code。我有基址0xDEADBEEF,并希望这样写的:

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);

内联汇编不是我的选择,因为生成的机器code是依赖于程序状态。

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?)

推荐答案

您可以使用尼古拉斯·卡彭的 softwire 。它真的不支持任何更多,因为他现在工作在一个类似的产品在Transgaming称为SoftAsm。它仍然还挺你想要做什么。

You could use Nicolas Capen's softwire. Its really not supported any more as he now works on a similar product at Transgaming called SoftAsm. Still it kinda does what you want.

修改2014年6月: - 它出现在SourceForge上以上链接已被删除,但它似乎是在LGPL许可下的这里

Edit June 2014: - It appears the sourceforge link above has been removed but it appears to be available under an LGPL license here.

这篇关于是否有一种运行C ++库汇编周围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆