bd44b5aa08
Nix / Required Checks: Nix (push) Blocked by required conditions
Nix / check-zig-cache-hash (push) Waiting to run
Test / skip (push) Waiting to run
Test / Required Checks: Test (push) Blocked by required conditions
Test / build-bench (push) Blocked by required conditions
Test / list-examples (push) Blocked by required conditions
Test / Example ${{ matrix.dir }} (Windows) (push) Blocked by required conditions
Test / Example ${{ matrix.dir }} (push) Blocked by required conditions
Test / build-cmake (push) Blocked by required conditions
Test / test-lib-vt-pkgconfig (push) Blocked by required conditions
Test / build-flatpak (push) Blocked by required conditions
Test / build-snap (push) Blocked by required conditions
Test / build-linux (namespace-profile-ghostty-md-arm64) (push) Blocked by required conditions
Test / build-nix (namespace-profile-ghostty-md) (push) Blocked by required conditions
Test / build-libghostty-vt (aarch64-linux) (push) Blocked by required conditions
Test / build-libghostty-vt (aarch64-macos) (push) Blocked by required conditions
Test / build-libghostty-vt (wasm32-freestanding) (push) Blocked by required conditions
Test / build-libghostty-vt (x86_64-linux) (push) Blocked by required conditions
Test / build-libghostty-vt (x86_64-linux-musl) (push) Blocked by required conditions
Test / build-libghostty-vt (x86_64-macos) (push) Blocked by required conditions
Test / build-libghostty-vt (x86_64-windows-gnu) (push) Blocked by required conditions
Test / build-libghostty-vt-macos (aarch64-ios) (push) Blocked by required conditions
Test / build-libghostty-vt-macos (aarch64-macos) (push) Blocked by required conditions
Test / build-libghostty-vt-macos (x86_64-macos) (push) Blocked by required conditions
Test / build-libghostty-vt-android (aarch64-linux-android) (push) Blocked by required conditions
Test / build-libghostty-vt-android (arm-linux-androideabi) (push) Blocked by required conditions
Test / build-libghostty-vt-android (x86_64-linux-android) (push) Blocked by required conditions
Test / build-libghostty-vt-windows (push) Blocked by required conditions
Test / build-libghostty-windows-gnu (push) Blocked by required conditions
Test / build-linux (namespace-profile-ghostty-md) (push) Blocked by required conditions
Test / build-linux-libghostty (push) Blocked by required conditions
Test / build-nix (namespace-profile-ghostty-md-arm64) (push) Blocked by required conditions
Test / build-dist (push) Blocked by required conditions
Test / build-dist-lib-vt (push) Blocked by required conditions
Test / trigger-snap (push) Blocked by required conditions
Test / trigger-flatpak (push) Blocked by required conditions
Test / build-macos (push) Blocked by required conditions
Test / build-macos-freetype (push) Blocked by required conditions
Test / test (push) Blocked by required conditions
Test / test-lib-vt (push) Blocked by required conditions
Test / GTK x11=false wayland=false (push) Blocked by required conditions
Test / GTK x11=true wayland=false (push) Blocked by required conditions
Test / GTK x11=false wayland=true (push) Blocked by required conditions
Test / GTK x11=true wayland=true (push) Blocked by required conditions
Test / Build -Dsimd=false (push) Blocked by required conditions
Test / Build -Dsimd=true (push) Blocked by required conditions
Test / Build -Dsentry=false (push) Blocked by required conditions
Test / Build -Dsentry=true (push) Blocked by required conditions
Test / test-macos (push) Blocked by required conditions
Test / test-windows (push) Blocked by required conditions
Test / Build -Di18n=false (push) Blocked by required conditions
Test / Build -Di18n=true (push) Blocked by required conditions
Test / Build test/fuzz-libghostty (push) Blocked by required conditions
Test / zig-fmt (push) Blocked by required conditions
Test / GitHub Actions Pins (push) Blocked by required conditions
Test / prettier (push) Blocked by required conditions
Test / swiftlint (push) Blocked by required conditions
Test / alejandra (push) Blocked by required conditions
Test / typos (push) Blocked by required conditions
Test / shellcheck (push) Blocked by required conditions
Test / translations (push) Blocked by required conditions
Test / blueprint-compiler (push) Blocked by required conditions
Test / Test pkg/wuffs (push) Blocked by required conditions
Test / Test build on Debian 13 (push) Blocked by required conditions
Test / valgrind (push) Blocked by required conditions
53 lines
1.7 KiB
C
53 lines
1.7 KiB
C
/*
|
|
* Minimal reproducer for the ghostty-internal DLL CRT initialization issue.
|
|
*
|
|
* Before the fix (DllMain calling __vcrt_initialize / __acrt_initialize),
|
|
* loading ghostty-internal.dll and calling any function that touches the C
|
|
* runtime crashed with "access violation writing 0x0000000000000024" because
|
|
* Zig's _DllMainCRTStartup does not initialize the MSVC C runtime for DLL
|
|
* targets.
|
|
*
|
|
* This test loads the DLL and calls ghostty_info, which exercises the CRT
|
|
* (string handling, memory). If it returns a version string without
|
|
* crashing, the CRT is properly initialized.
|
|
*
|
|
* Build: zig cc test_dll_init.c -o test_dll_init.exe -target native-native-msvc
|
|
* Run: copy ..\..\zig-out\lib\ghostty-internal.dll . && test_dll_init.exe
|
|
*
|
|
* Expected output (after fix):
|
|
* ghostty_info: <version string>
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <windows.h>
|
|
|
|
typedef struct {
|
|
int build_mode;
|
|
const char *version;
|
|
size_t version_len;
|
|
} ghostty_info_s;
|
|
|
|
typedef ghostty_info_s (*ghostty_info_fn)(void);
|
|
|
|
int main(void) {
|
|
HMODULE dll = LoadLibraryA("ghostty-internal.dll");
|
|
if (!dll) {
|
|
fprintf(stderr, "LoadLibrary failed: %lu\n", GetLastError());
|
|
return 1;
|
|
}
|
|
|
|
ghostty_info_fn info_fn = (ghostty_info_fn)GetProcAddress(dll, "ghostty_info");
|
|
if (!info_fn) {
|
|
fprintf(stderr, "GetProcAddress(ghostty_info) failed: %lu\n", GetLastError());
|
|
return 1;
|
|
}
|
|
|
|
ghostty_info_s info = info_fn();
|
|
fprintf(stderr, "ghostty_info: %.*s\n", (int)info.version_len, info.version);
|
|
|
|
/* Skip FreeLibrary -- ghostty's global state cleanup and CRT
|
|
* teardown ordering is not yet handled. The OS reclaims everything
|
|
* on process exit. */
|
|
return 0;
|
|
}
|