Confusing types for callbacks #5493
TonyCongqianWang
started this conversation in
General
Replies: 1 comment
-
After thinking about it for a while I got it working as I want, though it is not pretty. I changed all pointers in my signature to |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I tried to use a python function as callback and could not get it to work. After some testing I got very confused:
The signature I tested was
const std::function<void(double[])>
as I wanted to use a numba cfunc as a callback to modify values in my array. I was very confused, that the value of the first array member was passed instead. After digging around in the issues I found out that this was intended behaviour. Appearentlyconst std::function<void(double*)>
means that the value gets passed as a reference. This was not intuitive to me at all and I couldn't find the documentation of this behaviour.Is there any way to actually modify an array? As I want to fill an large Array with values , I want to avoid using callbacks returning a single double. In some issues I found usage of struct types or std::vectors, but I am unsure on how to transfer this to my use case.
Beta Was this translation helpful? Give feedback.
All reactions