Closed ewpratten closed 7 months ago
The way the procmacro works is it appends a one-liner to the code in the body of the function. An extern function doesn't have a body, so we can't really inject new behavior into it. I suspect any solution for this would ultimately behind the scenes just wrap the call in a rust function.
I try to keep procmacros extremely straightforward and use them sparingly, and I think the cost/benefit ratio for this would be outside my comfort zone. (I'd keep an open mind if you wanted to give it a try though.)
Ah, I figured.
I'm going to try auto-wrapping the functions then.
Since this has been idle for a while and I'm not optimistic a solution would be simple, going to close.
I would like to be able to profile some
extern "C"
functions.Currently, if I try to apply the
#[profiling::function]
macro to one of these functions, I get an error:Is there any way to do this without wrapping every external function in a Rust function first?