I am trying to write pointers to c method as such:
//c signature:
typedef void (*startDocumentSAXFunc) (void *ctx);
//Swift2 working code
let startDocument: @convention(c) (UnsafeMutablePointer<Void>) -> Void = { (ctx) -> Void in
NSLog("Start Document")
}
- I can't find what type to use for xmlChar**
//c signature
typedef void (*startElementSAXFunc) (void *ctx,
const xmlChar *name,
const xmlChar **atts);
//Swift2 code
let startElement: @convention(c) (UnsafeMutablePointer, UnsafePointer, ???) -> Void = { (ctx, name, attributes) -> Void in
NSLog("Start Element \(name), \(attributes)")
}
- I can't find what type to use for const char*
//c signature
typedef void (XMLCDECL *errorSAXFunc) (void *ctx,
const char *msg, ...);
//Swift2
let error: @convention(c) (UnsafeMutablePointer, ???) -> Void =
{ (ctx, msg) -> Void in
NSLog("Error \(msg)")
}
I tried the type UnsafePointer<CChar> but it is not working.
The aim here is to be able to use the libXML which is quicker than NSXML lib.
Thanks for your help !