It seems to me that an interesting tool in the swift toolchain would be one that could generate implementations of methods in circumstances like this, using, for instance, CPP macros as hints for function prototypes. Then again, I might be entirely wrong and I'd be happy to be corrected!
Tom Sent from my iPhone > On 5 Jan 2016, at 16:57, Kate Stone <katherine_st...@apple.com> wrote: > >> On Jan 5, 2016, at 12:32 PM, Ryan Lovelett via swift-dev >> <swift-dev@swift.org> wrote: >> >> Just to be clear though the intent of my question was not to quibble >> with compiler error messages. My real question is how are we meant to do >> systems programming with Swift on Linux if we cannot call ioctl? > > In the absence of an automatic mechanism for importing the definition of > variadic functions you can still define your own prototypes and bind them to > the system implementation. For example, this declaration: > > @_silgen_name("ioctl") func ioctl(fildes: CInt, request: UInt64, result: > UnsafePointer<Int>) -> Int > > … gives you a non-variadic interface to ioctl that you can use for > invocations that conform to this specific convention. You can define as many > overloads as you wish, and so long as you’re cautious about which one you’re > using for a given request you should be able to make progress. > > The same basic strategy can be applied to any variadic functional interfaces. > Ideally you’d want to hide this implementation detail behind a more > Swift-friendly API where the request type is implied to create a more > type-safe interface. > > Kate Stone k8st...@apple.com > Xcode Low Level Tools >
_______________________________________________ swift-dev mailing list swift-dev@swift.org https://lists.swift.org/mailman/listinfo/swift-dev