I’m using a C function that expects a pointer to an Array. But somehow, I can’t find a way to pass that pointer over.
Here’s what I’m trying:
import Foundation
let array = [1, 2, 3]
func doSomething(_ data: UnsafePointer<Void>) {
print("I'm not really doing something.")
}
doSomething(array)
This leads to the following error:
“Parameter 1 is “Swift.Array<Int64!>”, should be “UnsafePointer”, in call to PlayGround.doSomething(_ data: UnsafePointer)”
The same works in Xcode — granted, that’s Swift 4, and I need to replace that pointer type with “UnsafeRawPointer” instead. My guess is that I need to access the array differently in Swift 3 — but I just couldn’t find a way to do this.
If anyone has an idea, I’m all ears!
Thanks a lot in advance — any help is appreciated!