Hi, 2015-05-13 7:39 GMT+02:00 Yicong Huang <hengha....@gmail.com>:
> 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_source_ptr", and pass a pointer to a C variable. >From the Python side, it's turned into an int, that you can cast back to a ffi pointer. Something like this: import cffi ffi = cffi.FFI() result_ptr = ffi.cast('double *', c_argument) result_ptr[0] = 42.0 -- Amaury Forgeot d'Arc
_______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev