def test_opaque_integer_as_function_result():
#import platform
#if platform.machine().startswith('sparc'):
# py.test.skip('Breaks horribly on sparc (SIGILL + corrupted stack)')
#elif platform.machine() == 'mips64' and sys.maxsize > 2**32:
# py.test.skip('Segfaults on mips64el')
# XXX bad abuse of "struct { ...; }". It only works a bit by chance
# anyway. XXX think about something better :-(
ffi = FFI()
ffi.cdef("""
typedef struct { ...; } myhandle_t;
myhandle_t foo(void);
""")
lib = ffi.verify("""
typedef short myhandle_t;
myhandle_t foo(void) { return 42; }
""")
h = lib.foo()
assert ffi.sizeof(h) == ffi.sizeof("short")
评论列表
文章目录