Facing compilation errors if I call variable argument C++ API from swift lang


I have an API with variable arguments in C++ library. I am trying to call this API from swift language. But I am facing with compilation errors as below. If I tried by removing variable arguments from the API then it is compiling. Please help to fix the error with variable arguments.

API is
Code Block
void netops_log(enum log_level loglevel, const char *format, ...);

Compilation errors:
Code Block
FilterDataProvider.swift:73:9: error: 'netops_log' is unavailable: Variadic function is unavailable
    netops_log(LOGLEVEL_DEBUG, "Starting the filter... from NE")
    ^~~~~~~~~~~~
__ObjC.netops_log:2:13: note: 'netops_log' has been explicitly marked unavailable here
public func netops_log(_ loglevel: log_level, _ format: UnsafePointer<Int8>!, _ varargs: Any...)

      ^
As is written in the error message: Variadic function is unavailable.

Variadic functions (variable arguments) in C cannot be imported into Swift.
If your API has a variant using va_list (like vprintf for printf), you may be able to import it and write a Swift wrapper to use it as a Swift variadic function.

Using Imported C Functions in Swift

Or else, you may need to write many type-specific wrappers in C and import them into Swift...

Just note in case anyone arrived here (as I..) searching to fix:

let rc = sqlite3_config(SQLITE_CONFIG_SERIALIZED)

use:

    sqlite3_open_v2(databasePath, &db, SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE|SQLITE_OPEN_FULLMUTEX, nil)

instead.

Facing compilation errors if I call variable argument C++ API from swift lang
 
 
Q