def test_include_2():
ffi1 = FFI()
ffi1.cdef("struct foo_s { int x, y; };")
verify(ffi1, "test_include_2_parent", "struct foo_s { int x, y; };")
ffi = FFI()
ffi.include(ffi1)
ffi.cdef("struct foo_s *ff2(struct foo_s *);")
lib = verify(ffi, "test_include_2",
"struct foo_s { int x, y; }; //usually from a #include\n"
"struct foo_s *ff2(struct foo_s *p) { p->y++; return p; }")
p = ffi.new("struct foo_s *")
p.y = 41
q = lib.ff2(p)
assert q == p
assert p.y == 42
assert ffi1.typeof("struct foo_s") is ffi.typeof("struct foo_s")
评论列表
文章目录