Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let string = "message"
- let array = Array(string.utf8)
- let bytes = Data(string.utf8)
- CALL_C_FUNC(string, Int32(string.count)) //works
- CALL_C_FUNC(array, Int32(array.count)) //works
- CALL_C_FUNC(bytes, Int32(bytes.count)) //does not work
- //instead use:
- bytes.withUnsafeBytes { (pBytes: UnsafePointer<UInt8>) in
- CALL_C_FUNC(pBytes, Int32(bytes.count))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement