How to extend Numba so it supports pybind11-wrapped C++ struct?

Hi!

First, a bit more on my use case: I have a C++ application embedding the Python interpreter through pybind11, and calling specific Python functions with structs containing data from the application as parameters.

In this context, I am trying to call @njit-decorated functions from the functions called by the application (this is a first step, as I would like to directly call @cfunc-decorated functions later on), and I have trouble passing the Python object wrapping my structs to these functions as Numba does not recognize those.

To solve this, I’m trying to register these structs with the extending API, following the Interval example, but the furthest I’ve gone is getting stack overflows on the compilation. Anyway, I’m not even sure this is the correct way to go about this as my objects are not native Python objects. Ideally I would like to teach Numba how to directly access the various fields of my structs but I’m not sure which direction to take to do this.

Any help would be greatly appreciated!
Cheers