Hi,

The below is the code we met troubles;

ffi.cdef('''
  struct API {
     struct api_ret* (*pyudf)(char* str);
  };
''')

ffi.cdef('''
  struct api_ret {
     char *ret1;
     char *ret2;
     char *ret3;
  };
''')

result = ffi.new('struct api_ret*')

At first, we defined struct API with a function pointer that return a
pointer to struct api_ret.
And then we defined api_ret, and tried to new the object.
The problem seems to happen when the function pointer and new structure are
together.
The below code had no problems.

ffi.cdef('''
  struct API {
     struct api_ret* (*pyudf)(char* str);
  };
''')

ffi.cdef('''
  struct api_ret2 {
     char *ret1;
     char *ret2;
     char *ret3;
  };
''')
#we used different name api_ret2 to work around the issue.
result = ffi.new('struct api_ret2*')
_______________________________________________
pypy-dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to