我正在使用 PyPy 将一些 python 代码转换为 C 代码。我写了一个非常简单的脚本,如下所示:
def main():
print "hello world!"
def entry_point(argv):
main()
return 0
def target(*args):
return entry_point, None
然后我使用了translate.py --source test.py
。它确实成功生成了C代码。当我make
这些代码时,它生成了一个可执行文件test-c
。但是我无法使用 grep 找到这些代码中的 main 函数,所以我想知道 pypy 生成的代码的入口点在哪里。
感谢您的阅读。
最佳答案
这是不正确的。 Grep 查找 pypy_g_entry_point。 main() 函数在这个例子中很可能是内联的,所以你不会明白它。如果您希望渲染它,请使用 --inline-threshold=0 作为翻译参数。
关于python - pypy生成的C代码的入口点在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4190481/