cannot convert value of type '(OpaquePointer, UnsafePointer, CVarArg...) -> ()' (aka '(OpaquePointer, UnsafePointer, CVarArg...) -> ()') to expected argument type 'xmlGenericErrorFunc?' (aka 'Optional')
I suppose I need to do something like this instead:
xmlSetGenericErrorFunc(nil, OpaquePointer(handleValidationError)) //I can't figure out how to create an OpaquePointer instance here
You aren't going to be able to interface with this API from Swift, unfortunately, since Swift cannot use C variadic functions. You'll need to write a C wrapper function to interface with the API and then call into that from Swift.
Ah. Just for the sake of education. If the callback isn't a variadic function, how would we get it to work? (I couldn't find any docs or anything online that showed how to do it).
For printf, there is at least also vprintf, an alternative entry point that takes a va_list. You should be able to use the withVaList standard library function to pass down a va_list.