Cpp to kotlin

#1

Hello,
I want to use opc_ua cpp library in kotlin_native

I almost at the end part. please help me

I created .def file and using kotlinc-native compiler i made .klib file
I got a library file “lib.kt”
i made a sample.kt for test this library.
when i write code import are working fine
But when I run i got error type mismatch for every imports.
I attached lib.kt file and sample.kt
kotlin.zip (690.6 KB)
I have no idea why it’s not working

thank you

#2

Kotlin/Native does not support interop with C++, only with plain C and Objective-C.

#3

thank you for your reply.
i convert to C. and make code more simple.

import lib.*

fun main() {
val config = UA_ServerConfig_new_default()
val server = UA_Server_new(config)
println(“server on”)
UA_Server_delete(server)
UA_ServerConfig_delete(config)

}

and i got error something like this