Yes, but in any case shouldn't they be in the architecture directory (as in Windows there aren't fat binaries)? This would also apply to the Linux toolchain.
I have retried the procedure on a Windows 10 machine and it works!
C:\Users\pvieito\Downloads>more main.swift
print("Hello World!")
print()
@_silgen_name("GetVersion")
func GetVersion() -> CUnsignedLong
print("Windows Version: \(GetVersion())")
print()
let a = 2
for x in 0...a {
print("Iteration: \(x)")
}
print("Random Int: \(Int.random(in: 0...a))")
print("Random Bool: \(Bool.random())")
C:\Users\pvieito\Downloads>swiftc .\main.swift -o main.exe -O && main.exe
Hello World!
Windows Version: 602931718
Iteration: 0
Iteration: 1
Iteration: 2
Random Int: 2
Random Bool: false
I suppose the BCryptGenRandom
call from the Standard Library is not working properly on Windows 7 and is hanging the process.
Also, some extra notes:
- The WinSDK / MSVCRT modules fail to import. I thought it was due to the missing
ucrt
,visualc
andwinsdk
modulemaps but I manually copied them from the Swift repo tousr\lib\swift\windows\x86_64
with no success. - I also tried @Torust sample code and it crashes on this map to tuple (
SubBoard.allSubBoards.map({ ($0, self.viewForSubBoard($0)) })
). Changing to an in-loop operation the process runs sucessfully.