Applying cfunc decorator to numba extension type

I’d like to create a JIT-compiled callback function that will be passed to a C++ library (via a pybind11 wrapper). The issue is that the library requires a callback that looks something like

bool callback_func(cpp_obj &obj);

where the cpp_obj type is made available in python with pybind11.

By following the numba extension API documentation I’ve managed to get my callback function to jit compile via the @njit decorator, but I think what I really need is to use the @cfunc decorator (and the callback_func.ctypes attribute) so that the library can call the callback without invoking the python interpreter.

Unfortunately, when I try this I get the error “TypeError: Cannot convert Numba type ‘cpp_obj’ to ctypes type”.

Any thoughts on how I can get around this? Presumably I need to somehow define a ctypes type corresponding to the object and register that with numba?