CFFI - Is Python callback for C code possible in ABI mode?
<p>I need a provide a callback for C code. Basically, I need this to work:</p>

<p>In C:</p>

<pre><code>typedef int callback_t(int i);
callback_t *callback = NULL;
</code></pre>

<p>in Python:</p>

<pre><code>from cffi import FFI

def py_callback(i):
    return 0

ffi_builder = FFI()
lib = ffi_builder.dlopen('foobar.so')
lib.callback = py_callback
</code></pre>

<p>Adding <code>@ffi_builder.def_extern()</code> to <code>py_callback</code> throws an exception: <code>ffi.def_extern() is only available on API-mode FFI objects</code>.</p>

<p>So is it possible in ABI mode at all?</p>