Open tleyden opened 3 months ago
DEBUG
is an env var set by cargo for build scripts, it should be true
by default when compiling in debug mode. Were you compiling in debug or release mode?
I'm not familiar with @inline(never)
and the like.
@Brendonovich I'm compiling via Tauri+yarn (which invokes cargo
), and it was happening with both yarn tauri dev
and yarn tauri release
.
Maybe they don't set DEBUG
?
I recently had a bug in my own code that was causing a crash, but it was difficult to debug because the stack traces were misleading due to function inlining. For example I was getting a thread crash with:
but I know for a fact that the actual crash was emanating from a different swift function,
func getFrontmostAppWindowID(frontmostAppPid: Int) -> Int
, which is invoked by thescreen_capture(..)
function.I was able to improve the situation by adding the
DEBUG=true
env variable, which I noticed here:https://github.com/Brendonovich/swift-rs/blob/50a909d259ffcc743ae9232eac7d913c66f7e939/src-rs/build.rs#L222-L224
The new and improved stack trace showed the crash emanating from the expected function:
NOTE that I also tried decorating the function in question with
@inline(never)
, but it didn't seem to help. Maybe since it was defaulting to a release build it was ignoring those compiler hints.I didn't see the
DEBUG
flag mentioned in the docs, but maybe I missed it. If it's not there, would you take a PR to update the README?swift-rs has been working great for me, and thanks again @Brendonovich for creating this project!