Hi everyone!
I’m working on a library to expose Kotlin/Native bindings and have a question about handling variadic C functions on Linux native. Specifically, I’m dealing with functions like these:
C function:
void g_log(const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...) G_GNUC_PRINTF(3, 4);
Kotlin/Native cinterop:
fun g_log(log_domain: String?, log_level: Int, format: String?, vararg variadicArguments: Any?): Unit
And:
void g_logv(const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args) G_GNUC_PRINTF(3, 0);
Kotlin/Native cinterop:
fun g_logv(log_domain: String?, log_level: Int, format: String?, args: CPointer<platform.posix.__va_list_tag>?): Unit
I’m aware of
KT-56164, which states that there’s currently no official support. However, I wanted to check here to see if anyone has found a workaround or a way to support these functions, even if it’s a bit hacky.
I’m currently focusing on Linux, so a solution specific to this platform would be fine.
Any insights or advice would be greatly appreciated!