C ++名称Mangling Python for Python [英] C++ Name Mangling Library for Python

查看:133
本文介绍了C ++名称Mangling Python for Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Python程序中修改和解构C ++函数名称。
有什么可用的?我现在搜索了几个小时,也许我很幸运...

I'd like to mangle and demangle C++ function names in a Python program. Is there anything like that available? I searched for hours now, perhaps I'm lucky here...

推荐答案

你很可能不想做这在Python。作为一个旁白,你可能不应该从你的DLL中导出被破坏的名称,因为它使得难以使用具有不同编译器的任何人。

You most likely don't want to be doing this in Python. As an aside you probably shouldn't be exporting mangled names from your DLLs since it makes it hard to use for anyone with a different compiler.

如果你必须使用mangled名称,然后只是硬编码他们在你的Python代码。如果你打算在Python代码中做mangling,那么你必须:

If you have to use mangled names then just hard code them in your Python code. If you were going to do mangling in Python code then you'd have to:


  1. 知道编译器的具体实现规则。

  2. 在Python中指定每个函数的C ++函数签名。

我在Python中编码所有这一切将比简单地硬编码的错误名称。

It seems highly unlikely to me that coding all this up in Python would be better than simply hard coding the mangled names.

这篇关于C ++名称Mangling Python for Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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