开发者

Where is the entry-point of the C code generating by pypy

I'm using PyPy to translate some python code to C code. I wrote a very simple script as below:

def main():
    print "hello world!"

def entry_point(argv):
    main()
    return 0

def target(*args):
    return entry_point, None

Then I used translate.py --source test.py. It did generate C code successful. When I make those code, it generated a executable file test-c. However I cannot find the m开发者_如何学Goain function in those code using grep, so I'm wondering where is the entry-point of the code generating by pypy. Thank you for your reading.


that's incorrect. Grep for pypy_g_entry_point. main() function is likely to be inlined in this example, so you won't get it. If you want it to be rendered use --inline-threshold=0 as a translation parameter.


PyPy is probably not giving you a "main" function because you actually don't have an entry point in your Python code. You should probably just add

main()

at the end of the file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜