fix: implement IobShim.cpp

This commit is contained in:
DwifteJB 2026-03-04 21:27:29 +00:00
parent bf31940091
commit ee78a74025
No known key found for this signature in database
GPG key ID: E9A084A6DBE8B6A0

View file

@ -1,5 +1,7 @@
// Original file is iob_shim.asm
// Rewritten in C because the build system breaks on linux-windows crosscomp with this
// rm: __declspec(naked) is seemingly(?) not working on x86_64 (atleast via wine); use __attribute__((naked)) instead.
#if 0
.code
EXTRN __acrt_iob_func:PROC
@ -14,7 +16,11 @@ END
#include <cstdio>
extern "C" FILE* __cdecl __iob_func ( void ) {
static FILE iob [ ] = { *stdin, *stdout, *stderr };
return iob;
extern "C" FILE* __cdecl __acrt_iob_func(unsigned index);
extern "C" __attribute__((naked)) FILE* __cdecl __iob_func(void) {
__asm__(
"xorl %ecx, %ecx\n\t"
"jmp __acrt_iob_func"
);
}