I have a C API, which has signature like:
SendPing(char * content);
Now, I want to call it from Swift. Swift seems like auto imported it as:
SendPing(content: UnsafeMutablePointer<Int8>!)
But, when I try it in Swift like:
var content:String = "sampledata"
SendPing(content)
I thought Swift can automatically handle "String" to "UnsafeMutablePointer" convertion but it doesn't. Reported error is: "Cannot convert value of type 'String' to expected argument type 'UnsafeMutablePointer!'. I remember it works in Swift 3.0 but I may be wrong.
What's the right way to handle this in Swift 4.2?
solution posted in question: Swift convert string to UnsafeMutablePointer<Int8> doesn't work for me. I couldn't figure out the root cause but I guess it's due to Swift 4.2.