You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Importation of fclose on Linux appears to have changed with Swift 5.9 (Swift version 5.9-dev (LLVM 6665c55e557222b, Swift b370e7dbea9ca19)) and internal typealias FILEPointer = UnsafeMutablePointer<FILE> in NIOSSL/PosixPort.swift fails to compile.
/home/ryan/Projects/Develop/Tsunami/.build/checkouts/swift-nio-ssl/Sources/NIOSSL/PosixPort.swift:42:64: error: cannot convert value of type '(UnsafeMutablePointer<FILE>) -> Int32' (aka '(UnsafeMutablePointer<_IO_FILE>) -> Int32') to specified type '@convention(c) (FILEPointer?) -> CInt' (aka '@convention(c) (Optional<UnsafeMutablePointer<_IO_FILE>>) -> Int32') private let sysFclose: @convention(c) (FILEPointer?) -> CInt = fclose
Changing the sysFclose definition to private let sysFclose: @convention(c) (FILEPointer) -> CInt = fclose by putting making FILEPointer non-optional matches the expected method signature and allows compilation to succeed, but there may be a better way to solve this (or wrapping this in a Swift 5.9 conditional).
The text was updated successfully, but these errors were encountered:
That's very weird: I can't entirely work out why this change would have happened, as I'd expect it to be a libc change. Still this is an easy enough tweak to make.
@Lukasa@tokyovigilante I tried to make an PR for suggestion but failed - not sure how to suggest code. The suggestions are quite small though and they work on my computer (I use Linux 6.5.9-arch2-1 - Glibc 2.38):
Here's the text changed:
// fclose has an non optional file pointer for linux glibc version 2.38
#if os(Linux)
internal typealias SYSFILEPointer = FILEPointer
#else
internal typealias SYSFILEPointer = Optional
#endif
and here's the code replaced for the return type for fclose:
private let sysFclose: @convention(c) (SYSFILEPointer) -> CInt = fclose
Importation of
fclose
on Linux appears to have changed with Swift 5.9 (Swift version 5.9-dev (LLVM 6665c55e557222b, Swift b370e7dbea9ca19)
) andinternal typealias FILEPointer = UnsafeMutablePointer<FILE>
inNIOSSL/PosixPort.swift
fails to compile./home/ryan/Projects/Develop/Tsunami/.build/checkouts/swift-nio-ssl/Sources/NIOSSL/PosixPort.swift:42:64: error: cannot convert value of type '(UnsafeMutablePointer<FILE>) -> Int32' (aka '(UnsafeMutablePointer<_IO_FILE>) -> Int32') to specified type '@convention(c) (FILEPointer?) -> CInt' (aka '@convention(c) (Optional<UnsafeMutablePointer<_IO_FILE>>) -> Int32') private let sysFclose: @convention(c) (FILEPointer?) -> CInt = fclose
Changing the
sysFclose
definition toprivate let sysFclose: @convention(c) (FILEPointer) -> CInt = fclose
by putting making FILEPointer non-optional matches the expected method signature and allows compilation to succeed, but there may be a better way to solve this (or wrapping this in a Swift 5.9 conditional).The text was updated successfully, but these errors were encountered: