Consider rewriting execCallback to not invoke R-based callbacks with our own C/C++ code on the call stack. This would remove our invocation of R_TopLevelExec which causes issues with withCallingHandlers (like expect_warning).
We could rewrite execCallback to only take the callback in C++, and return control to R which will invoke it. There will be some challenge here to maintain the do/while loop logic without inadvertently introducing changes.
Consider rewriting
execCallbackto not invoke R-based callbacks with our own C/C++ code on the call stack. This would remove our invocation of R_TopLevelExec which causes issues withwithCallingHandlers(likeexpect_warning).We could rewrite
execCallbackto only take the callback in C++, and return control to R which will invoke it. There will be some challenge here to maintain the do/while loop logic without inadvertently introducing changes.