Re: [pypy-dev] How to get the return value from pypy function for C code

2015-05-14 Thread Armin Rigo
Hi Yicong, On 13 May 2015 at 11:10, Amaury Forgeot d'Arc wrote: >> Does pypy have similar API? > > But don't you have it already? the func(3) above should return the integer 6! I would guess so too. The point of the PyPy "API" is that it is completely minimal. You have to do everything with CF

Re: [pypy-dev] How to get the return value from pypy function for C code

2015-05-13 Thread Amaury Forgeot d'Arc
2015-05-13 9:55 GMT+02:00 Yicong Huang : > Thanks for your advices! > But your code seems to only solve the problem about how to pass the > function parameter from C to Python. > In the document example: > > char source[] = "from cffi import FFI\n\ffi = > FFI()\n\@ffi.callback('int(int)')\n\def f

Re: [pypy-dev] How to get the return value from pypy function for C code

2015-05-13 Thread Yicong Huang
Thanks for your advices! But your code seems to only solve the problem about how to pass the function parameter from C to Python. In the document example: char source[] = "from cffi import FFI\n\ffi = FFI()\n\@ffi.callback('int(int)')\n\def func(a):\n\print 'Got from C %d' % a\n\return a *

Re: [pypy-dev] How to get the return value from pypy function for C code

2015-05-13 Thread Amaury Forgeot d'Arc
Hi, 2015-05-13 7:39 GMT+02:00 Yicong Huang : > From the document " "Embedding Pypy", we got the method to call python > function from C code. > But there are no examples on how to get the function return value. > Does pypy have this feature? > I think you need to use the function "pypy_execute_