I tried to google for an answer but couldn't find anything. What is the correct way to do the following on Linux?
@_silgen_name("foo") func foo(theInt: UInt) -> (a: UInt, b: UInt, c: UInt) var (d, e, f) = foo(aNum) Where foo is: typedef struct { long a; long b; long c; } Tuple; extern "C" { Tuple foo(int i) { return Tuple{ i, i, i }; } } Currently, the call to foo crashes because foo wants to return the tuple indirectly, but the Swift call expects the three scalar return values in registers. This example is a generalization of runtime functions such as swift_class_getInstanceExtents, which happens to work because it only returns two scalars in RAX and RDX, which is supported by Clang. But my tests show that three-scalar tuples/structs will cause problems. On architectures where Clang only supports one scalar return value, the problem is worse. Am I doing something wrong or is there already a way to deal with this (e.g. annotation in Swift code to make it obey C ABI, or vice versa)? Thanks, Bryan
_______________________________________________ swift-dev mailing list swift-dev@swift.org https://lists.swift.org/mailman/listinfo/swift-dev