Commit Graph

5 Commits

Author SHA1 Message Date
Paul Sokolovsky af5b509c75 examples/unix/ffi_example: Clean up and update the ffi example.
1. Use uctypes.bytearray_at().

Implementation of the "ffi" module predates that of "uctypes", so
initially some convenience functions to access memory were added
to ffi. Later, they landed in uctypes (which follows CPython's
ctype module).

So, replace undocumented experimental functions from ffi to
documented ones from uctypes.

2. Use more suitable type codes for arguments (e.g. "P" (const void*)
instead of "p" (void*).

3. Some better var naming.

4. Clarify some messages printed by the example.
2018-10-23 11:50:39 +11:00
Paul Sokolovsky 70536212d5 examples/unix/ffi_example.py: Remove TODO, make output more clear. 2016-06-17 19:24:58 +03:00
Paul Sokolovsky ecfd8e102d examples/unix/ffi_example.py: Update for current "ffi" module API. 2016-06-17 19:21:37 +03:00
Paul Sokolovsky 8bc3516389 ffi: Implement ffivar.get()/set() methods.
Done by introducing another factored out helper API in binary.c. This API
can be reused also by array and struct modules.
2014-02-14 20:38:35 +02:00
Paul Sokolovsky 809eaa2679 Add FFI module example. 2014-01-29 00:37:09 +02:00