diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-07 18:29:21 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-07 18:29:21 +0300 |
| commit | dcfe11a7588fcd42471159453810abc9b7720a57 (patch) | |
| tree | c32a77266028e73ca2382b96c96f8438a5fcd621 /vendor/libghostty-vt/src/main_c.zig | |
| parent | 2dfed860103c4e4505ac7f25def9fe37da1e1e6a (diff) | |
build: update libghostty-vt vendor
vendor ghostty 063ac3e and remove the musl libc++ link workaround.
expose the new selection formatter and hyperlink uri apis for follow-up rendering work.
add manual artifact validation for static linux builds.
Diffstat (limited to 'vendor/libghostty-vt/src/main_c.zig')
| -rw-r--r-- | vendor/libghostty-vt/src/main_c.zig | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/vendor/libghostty-vt/src/main_c.zig b/vendor/libghostty-vt/src/main_c.zig index ef8d9ec7..f61565f2 100644 --- a/vendor/libghostty-vt/src/main_c.zig +++ b/vendor/libghostty-vt/src/main_c.zig @@ -161,15 +161,17 @@ pub export fn ghostty_string_free(str: String) void { // function that depends on CRT internal state (setlocale, malloc from C // dependencies, C++ constructors in glslang) crashes with null pointer // dereferences. Declaring DllMain causes Zig's start.zig to call it -// during DLL_PROCESS_ATTACH/DETACH, and we forward to the CRT bootstrap -// functions from libvcruntime and libucrt (already linked). +// during DLL_PROCESS_ATTACH/DETACH, and for MSVC we forward to the CRT +// bootstrap functions from libvcruntime and libucrt (already linked). +// For other ABIs (MinGW) the handler is a no-op since dllcrt2.obj already +// handles CRT init; we still need `DllMain` declared so that Zig's +// start.zig does not fall back to calling a non-function value. // // This is a workaround. Zig handles MinGW DLLs correctly (via dllcrt2.obj) // but not MSVC. No upstream issue tracks this exact gap as of 2026-03-26. // Closest: Codeberg ziglang/zig #30936 (reimplement crt0 code). // Remove this DllMain when Zig handles MSVC DLL CRT init natively. -pub const DllMain = if (builtin.os.tag == .windows and - builtin.abi == .msvc) struct { +pub const DllMain = if (builtin.os.tag == .windows) struct { const BOOL = std.os.windows.BOOL; const HINSTANCE = std.os.windows.HINSTANCE; const DWORD = std.os.windows.DWORD; @@ -186,6 +188,8 @@ pub const DllMain = if (builtin.os.tag == .windows and const __acrt_uninitialize = @extern(*const fn (c_int) callconv(.c) c_int, .{ .name = "__acrt_uninitialize" }); pub fn handler(_: HINSTANCE, fdwReason: DWORD, _: LPVOID) callconv(.winapi) BOOL { + // Only MSVC needs to bootstrap the CRT; MinGW handles it via dllcrt2.obj. + if (builtin.abi != .msvc) return TRUE; switch (fdwReason) { DLL_PROCESS_ATTACH => { if (__vcrt_initialize() < 0) return FALSE; |
