Created
October 7, 2014 15:34
-
-
Save euphoria/e41259058557efa53876 to your computer and use it in GitHub Desktop.
cffi struct copy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffi.cdef("struct my_struct { int a; int b; };") | |
first = ffi.new("struct my_struct *") | |
first.a = 1 | |
first.b = 100 | |
""" | |
(Pdb) first | |
<cdata 'struct my_struct *' owning 8 bytes> | |
(Pdb) second = ffi.new("struct my_struct *", first) | |
*** TypeError: initializer for ctype 'struct my_struct' must be a list or tuple or dict or struct-cdata, not cdata 'struct my_struct *' | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment