Skip to content

Commit 367a941

Browse files
committed
fix: fffi mode in windows
1 parent a86aeab commit 367a941

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

skia/imzero_client_skia_sdl3_impl/main.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
#if defined(linux) || defined(__linux) || defined(__linux__)
66
#include <sys/prctl.h>
7+
#else
8+
#include <cstdio>
9+
#include <fcntl.h>
10+
#include <io.h>
711
#endif
812
#ifdef TRACY_ENABLE
913
#include <cstdlib>
@@ -59,6 +63,24 @@ static_assert(_HAS_ITERATOR_DEBUGGING == 0 && "_HAS_ITERATOR_DEBUGGING is not 0"
5963
static_assert(_ITERATOR_DEBUG_LEVEL == 0 && "_ITERATOR_DEBUG_LEVEL is not 0");
6064
#endif
6165

66+
#if defined(linux) || defined(__linux) || defined(__linux__)
67+
#else
68+
{
69+
auto result = _setmode(_fileno(stdin), _O_BINARY);
70+
if(result == -1) {
71+
perror("Cannot set mode binary mode");
72+
}
73+
result = _setmode(_fileno(stdout), _O_BINARY);
74+
if(result == -1) {
75+
perror("Cannot set mode binary mode");
76+
}
77+
result = _setmode(_fileno(stderr), _O_BINARY);
78+
if(result == -1) {
79+
perror("Cannot set mode binary mode");
80+
}
81+
}
82+
#endif
83+
6284
#ifdef TRACY_ENABLE
6385
ImGui::SetAllocatorFunctions(imZeroMemAlloc,imZeroMemFree,nullptr);
6486
#endif
@@ -74,8 +96,8 @@ static_assert(_ITERATOR_DEBUG_LEVEL == 0 && "_ITERATOR_DEBUG_LEVEL is not 0");
7496

7597
#if defined(linux) || defined(__linux) || defined(__linux__)
7698
if (0 > prctl(PR_SET_DUMPABLE, opts.fCoreDump ? 1 : 0)) {
77-
perror("unable to set prctl(PR_SET_DUMPABLE)");
78-
return 1;
99+
perror("unable to set prctl(PR_SET_DUMPABLE)");
100+
return 1;
79101
}
80102
#endif
81103

skia/run_windows.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
set -ev
3+
here=$(dirname "$(readlink -f "$BASH_SOURCE")")
4+
cd "$here"
5+
./build_go.sh
6+
font="./SauceCodeProNerdFontPropo-Regular.ttf"
7+
VSYNC="${VSYNC:-on}"
8+
./main_go --logFormat console --httpServerAddress localhost:8888 demo --imGuiBinary ./bin/imgui_skia.exe --mainFontTTF "$font" --mainFontSizeInPixels 13 \
9+
-clientFontManager "directwrite" -clientSkiaBackendType gl -clientVsync $VSYNC -clientTtfFilePath "$font" \
10+
-clientBackdropFilter off -clientVectorCmd on -clientImguiNavKeyboard on

0 commit comments

Comments
 (0)