This would result in the warning warning: function is marked #[no_mangle], but not exported and would indeed not export the function because it is local to a function context, so we'd get a link error.
Passing the pointer to the functions as parameters also does not work, because we want the function to be accessible even from lambda function within the cpp! macro.
The solution I found is to create an array of callback which are initialized on the first call of the closure.
Contains also some other small fixes.
We unfortunately can't just use the same trick as for the raw: The rust! code expands to something like this:
This would result in the warning
warning: function is marked #[no_mangle], but not exported
and would indeed not export the function because it is local to a function context, so we'd get a link error.Passing the pointer to the functions as parameters also does not work, because we want the function to be accessible even from lambda function within the cpp! macro.
The solution I found is to create an array of callback which are initialized on the first call of the closure.