<div dir="ltr">Hi Kevin,<div><br></div><div>More up to date information can be found on the FAQ page</div><div><br></div><div><a href="http://doc.pypy.org/en/latest/faq.html#do-cpython-extension-modules-work-with-pypy">http://doc.pypy.org/en/latest/faq.html#do-cpython-extension-modules-work-with-pypy</a><br>
</div><div><br></div><div>The best approach for PyPy is either use a pure Python module if possible or use a cffi wrapped extension instead of an extension that uses the CPython CAPI.  Often CPython CAPI extensions are wrapping some c library.  Creating a cffi wrapper for the library is actually much simpler than writing a CPython CAPI wrapper.  Quite a few CPython CAPI extensions have already been wrapped for cffi so make sure to search for one before creating your own wrapper. If you need to create a wrapper, refer to the cffi documentation at</div>
<div><br></div><div><a href="http://cffi.readthedocs.org/en/release-0.8/">http://cffi.readthedocs.org/en/release-0.8/</a><br></div><div><br></div><div>Extensions wrapped with cffi are compatible with both CPython and PyPy.  On CPython the performance is similar to what you would get if you used ctypes.  How every, under PyPy, the performance is much closer to a native C call plus the overhead for releasing and acquiring the gil.</div>
<div><br></div><div>John</div></div>