SQLite Forum

_vconfig variants taking ap_list
Login
[Swift](https://swift.org/about/) generally supports calling C functions but does not support C variadic functions. Swift does, however, support a type called [`CVarArg`](https://developer.apple.com/documentation/swift/cvararg) which is basically a `va_list`.

The current implementation of `sqlite3_config` in main.c looks like:

```
int sqlite3_config(int op, ...){
  va_list ap;
  int rc = SQLITE_OK;

  /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while
  ** the SQLite library is in use. */
  if( sqlite3GlobalConfig.isInit ) return SQLITE_MISUSE_BKPT;

  va_start(ap, op);
  /* implementation is here */
  va_end(ap);
  return rc;
}
```

It would be beneficial for using SQLite from Swift (and possibly other languages that don't support calling C variadic functions) if there were versions of the `_config` functions (`sqlite3_config` and `sqlite3_db_config`) that took a `va_list`, much like `vprintf`. A possible implementation could look like:

```
int sqlite3_config(int op, ...){
  va_list ap;
  va_start(ap, op);
  int rc = sqlite3_vconfig(op, ap);
  va_end(ap);
  return rc;
}

int sqlite3_vconfig(int op, va_list ap){
  /* existing implementation of sqlite3_config minus the va_start()/va_end() portion*/
}
```

I'm happy to submit a patch if this is something that would be considered.