[swift-users] Making a copy of an UnsafePointer

2017-11-14 Thread Rick Mann via swift-users
My code gets some data from an OpenCV cv::Mat object, and passes it to some Swift code that takes it via an UnsafePointer parameter. This works fine until I want to make the call asynchronous (using a DispatchQueue), I think because the underlying cv::Mat gets deallocated by the caller before

Re: [swift-users] Passing variadic C args through?

2017-11-14 Thread Rick Mann via swift-users
Here you go: https://bugs.swift.org/browse/SR-6386 > On Nov 14, 2017, at 18:01 , Jordan Rose wrote: > > Sure. I'm not sure we have a good idea for how to catch the bug—what if you > really meant to pass the array as an NSArray?—but it's worth recording > somewhere.

Re: [swift-users] Passing variadic C args through?

2017-11-14 Thread Jordan Rose via swift-users
Sure. I'm not sure we have a good idea for how to catch the bug—what if you really meant to pass the array as an NSArray?—but it's worth recording somewhere. Thanks, Rick. Jordan > On Nov 14, 2017, at 18:00, Rick Mann wrote: > > I tried to find an alternative init()

Re: [swift-users] Passing variadic C args through?

2017-11-14 Thread Rick Mann via swift-users
I tried to find an alternative init() to use, but couldn't (despite dozens of releases, Xcode's code completion still fails much of the time). Thanks for pointing me to the right one! Should I file a bug? > On Nov 14, 2017, at 17:47 , Jordan Rose wrote: > > Heh, it

Re: [swift-users] Passing variadic C args through?

2017-11-14 Thread Jordan Rose via swift-users
Heh, it would be nice to catch this. You're collecting a bunch of arguments in an Array, and then passing that array straight on as a single argument itself, which means it gets passed as either an NSArray or a pointer (not sure which). Use 'init(format:arguments:)' instead. Jordan > On Nov

[swift-users] Passing variadic C args through?

2017-11-14 Thread Rick Mann via swift-users
I've had a long-working `debugLog()` method that looks like this: ``` func debugLog(_ inMsg: T, file inFile : String = #file, line inLine : Int = #line) { let file = (inFile as NSString).lastPathComponent let s = "\(file):\(inLine)\(inMsg)" print(s) } ``` I wanted to

Re: [swift-users] Compile error trying to follow Swift for Windows MSVC instructions

2017-11-14 Thread Saleem Abdulrasool via swift-users
I’ve not used the MSVC build mode very much. I suspect that this is a name lookup failure and needs a namespace qualification. I’ll look into tweaking that when I’m near a computer. In the mean time, I recommend using the cross-compile or possibly trying with clang-cl. On Tue, Nov 14, 2017 at

Re: [swift-users] Compile error trying to follow Swift for Windows MSVC instructions

2017-11-14 Thread Michael Gottesman via swift-users
+CC Compnerd > On Nov 9, 2017, at 10:36 AM, Eric Wing via swift-users > wrote: > > I'm trying to build Swift for Windows with Visual Studio using the > directions found here: > https://github.com/apple/swift/blob/master/docs/Windows.md > > I'm following the MSVC section