1. Python CFFI
  2. Untitled project
  3. cffi
  4. Issues
Issue #146 resolved

incorrect type for c_callback variable?

Danek Duvall
created an issue

In order for the testsuite to pass using the Studio compilers on Solaris, I had to change the -Werror flag at the top of test_verify.py to -errwarn=E_ASSIGNMENT_TYPE_MISMATCH,E_RETURN_VALUE_TYPE_MISMATCH

Making assignment type mismatch an error, though, caused test_callback_indirection() to fail. In the generate _cffi_const_c_callback() function, we ended up with

void * i;
i = (c_callback);

where c_callback had been defined previously in the C file as

static int c_callback(int how_many, ...) { ... }

and so the assignment to "i" is a mismatch, and the compiler errors out. The preceding cdef included the following declaration, though:

void *const c_callback;

which presumably is why "i" was a void *. If I change the cdef line to read

int (c_callback)(int, ...);

then the C code uses the correct type for "i" and the test passes successfully.

Comments (1)

  1. Log in to comment