Replies: 1 comment
-
Sorry for the very slow reply. I don't think it will be possible to create a |
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
-
Hi - I am trying to write a python extension module using PyO3. The rust section orchestrates the computation while the actual function to execute is provided at runtime from python.
For regular python functions, I can pass them like any other arg and PyO3 casts it to a
PyObject
.However the computation is numerical, so I use the
numba
library to compile thecallback
function to native code. Though, calling the compiled routine through python would acquire and release the GIL each time.Numba also produces a C function pointer that can be passed to native libraries - link. This repository illustrates using it - link.
Is it possible to create a rust function using PyO3 that takes an
extern C fn(...)
as an argument?Beta Was this translation helpful? Give feedback.
All reactions