Quantcast
Viewing all articles
Browse latest Browse all 98

Flexible Python FFI (libffi) with ctypes and cffi

“Calling code from shared libraries in C is simple with dlopen / dlsym (LoadLibrary on Windows). I provided a comprehensive example in the article on Plugins in C; here, I’ll start with a simplified example…”

http://eli.thegreenplace.net/2013/03/04/flexible-runtime-interface-to-shared-libraries-with-libffi/

“In a previous post, I demonstrated how to use libffi to perform fully dynamic calls to C code, where “fully dynamic” means that even the types of the arguments and return values are determined at runtime.

Here I want to discuss how the same task is done from Python, both with the existing stdlib ctypes package and the new cffi library, developed by the PyPy team and a candidate for inclusion into the Python stdlib in the future…”

http://eli.thegreenplace.net/2013/03/09/python-ffi-with-ctypes-and-cffi/


Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 98

Trending Articles