Skip to content

Commit 5022dbc

Browse files
committed
stdlib: fix build for LLP64 targets
When building the stdlib for Windows x86_64, we would see the following error: swift/stdlib/public/core/RuntimeFunctionCounters.swift:95:19: error: '(UnsafeRawPointer, Int64) -> Void' is not representable in Objective-C, so it cannot be used with '@convention(c)' @convention(c) (_ object: UnsafeRawPointer, _ functionId: Int64) -> Void ^ This is caused by `Int64` not being mapped as on Windows x86_64, `CLong` is mapped to `Int32` and `CLongLong` is mapped to `Int`. This causes the `Int64` to fail to be reverse-mapped to a C type causing the FFI construction failure.
1 parent 4df3541 commit 5022dbc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

stdlib/public/core/RuntimeFunctionCounters.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,13 @@ internal func _collectAllReferencesInsideObjectImpl(
9191
// of runtime function counters.
9292
public // @testable
9393
struct _RuntimeFunctionCounters {
94+
#if os(Windows) && arch(x86_64)
9495
public typealias RuntimeFunctionCountersUpdateHandler =
95-
@convention(c) (_ object: UnsafeRawPointer, _ functionId: Int64) -> Void
96+
@convention(c) (_ object: UnsafeRawPointer, _ functionId: Int) -> Void
97+
#else
98+
public typealias RuntimeFunctionCountersUpdateHandler =
99+
@convention(c) (_ object: UnsafeRawPointer, _ functionId: Int64) -> Void
100+
#endif
96101

97102
public static let runtimeFunctionNames =
98103
getRuntimeFunctionNames()

0 commit comments

Comments
 (0)