Problem
Windows support has significant gaps across multiple subsystems. 74 #if os(Windows) blocks exist but many are incomplete or missing fallbacks.
Gap 1: Plugin loading uses dlopen (POSIX-only)
Files: NativePluginHost.swift:251, PluginLoader.swift:303
dlopen/dlsym/dlerror are called on non-Windows platforms, but the Windows LoadLibraryW/GetProcAddress path has issues:
- Library search uses
lib prefix (Unix convention) — Windows DLLs don't use lib prefix
- Hardcoded forward slashes in
target/release/lib{name}.{ext} paths
- No
FormatMessage equivalent for Windows error reporting (vs dlerror)
Gap 2: FileMonitor uses 1-second polling instead of ReadDirectoryChangesW
File: Windows/WindowsFileMonitor.swift
Polls directories every 1 second with O(n) scans. The correct Windows API (ReadDirectoryChangesW) is event-driven and O(1). Comment at line 6 acknowledges this.
Gap 3: HTTP response duration hardcoded to 0
File: Windows/WindowsHTTPServer.swift:185
durationMs: 0 // TODO: Track duration
All HTTP metrics show 0ms on Windows.
Gap 4: Terminal hidden input missing
File: Terminal/InputHandler.swift:87
Password input shows plaintext on Windows. Needs SetConsoleMode to disable echo.
Gap 5: Metrics collection missing
Files: MetricsCollector.swift, SystemMetricsService.swift
System metrics (CPU, memory) only implemented for macOS/Linux. No Windows GetProcessMemoryInfo/GetSystemTimes integration.
Gap 6: LLVM CodeGenerator entirely disabled
File: AROCompiler/LLVMC/LLVMCodeGenerator.swift:5
aro build is non-functional on Windows.
Suggested Fix
Create a platform abstraction layer:
protocol PlatformServices {
func loadDynamicLibrary(at path: URL) throws -> DynamicLibraryHandle
func createFileMonitor(path: URL) -> FileMonitorProtocol
func hiddenInput(prompt: String) -> String
func systemMetrics() -> SystemMetrics
}
Implement per-platform with compile-time selection. This eliminates scattered #if os(Windows) blocks.
Synced from GitLab issue #203
Problem
Windows support has significant gaps across multiple subsystems. 74
#if os(Windows)blocks exist but many are incomplete or missing fallbacks.Gap 1: Plugin loading uses dlopen (POSIX-only)
Files:
NativePluginHost.swift:251,PluginLoader.swift:303dlopen/dlsym/dlerrorare called on non-Windows platforms, but the WindowsLoadLibraryW/GetProcAddresspath has issues:libprefix (Unix convention) — Windows DLLs don't uselibprefixtarget/release/lib{name}.{ext}pathsFormatMessageequivalent for Windows error reporting (vsdlerror)Gap 2: FileMonitor uses 1-second polling instead of ReadDirectoryChangesW
File:
Windows/WindowsFileMonitor.swiftPolls directories every 1 second with O(n) scans. The correct Windows API (
ReadDirectoryChangesW) is event-driven and O(1). Comment at line 6 acknowledges this.Gap 3: HTTP response duration hardcoded to 0
File:
Windows/WindowsHTTPServer.swift:185All HTTP metrics show 0ms on Windows.
Gap 4: Terminal hidden input missing
File:
Terminal/InputHandler.swift:87Password input shows plaintext on Windows. Needs
SetConsoleModeto disable echo.Gap 5: Metrics collection missing
Files:
MetricsCollector.swift,SystemMetricsService.swiftSystem metrics (CPU, memory) only implemented for macOS/Linux. No Windows
GetProcessMemoryInfo/GetSystemTimesintegration.Gap 6: LLVM CodeGenerator entirely disabled
File:
AROCompiler/LLVMC/LLVMCodeGenerator.swift:5#if !os(Windows)aro buildis non-functional on Windows.Suggested Fix
Create a platform abstraction layer:
Implement per-platform with compile-time selection. This eliminates scattered
#if os(Windows)blocks.Synced from GitLab issue #203