When I try to pass an UnsafeMutableRawPointer as a function parameter I get the following error:
A C function pointer can only be formed from a reference to a 'func' or a literal closure
Specifically this is from the following code:
public func sqlite3_bind_text(_ oP: OpaquePointer!, _ first: Int32, _ second: UnsafePointer<Int8>!, _ third: Int32, _ ptrs: ((UnsafeMutableRawPointer?) -> Void)!) -> Int32 {
SQLite3.sqlite3_bind_text(oP, first, second, third, ptrs)
}
I've looked at: How to use instance method as callback for function which takes only func or literal closure but can't see how I can apply that to my situation.
How can I pass the pointer through my function?
SQLite3.sqlite3_bind_text(...)
_ ptrs: (@convention(c) (UnsafeMutableRawPointer?) -> Void)!
– But what is the point of defining a function with the same signature asSQLite3.sqlite3_bind_text
and forwarding the call?