Files
2026-07-13 12:29:49 +08:00

19 lines
765 B
C

// Zig's std.debug stack-trace symbolication (pulled in by the embed lib's
// panic path) references `_dyld_get_image_header_containing_address`, which
// the iOS SDK marks __API_UNAVAILABLE(ios). Provide the documented
// replacement (dladdr) under the old symbol so the static lib links; it
// only runs while formatting a panic trace. Mirrors the same shim in the
// mobile-canvas example's ObjC host (examples/mobile-canvas/ios/main.m).
#include <dlfcn.h>
#include <mach-o/dyld.h>
#include <stddef.h>
const struct mach_header *_dyld_get_image_header_containing_address(const void *address) {
Dl_info info;
if (dladdr(address, &info) != 0 && info.dli_fbase != NULL) {
return (const struct mach_header *)info.dli_fbase;
}
return NULL;
}