Hi, I'm building a library in Kotlin Multiplatfor...
# kotlin-native
a
Hi, I'm building a library in Kotlin Multiplatform and Kotlin Native that targets different platform including linuxArm32Hfp. The code I have on the linux side that interacts with the shared kotlin library code is in C++. Is there a way to change the projection to C++ instead of C? I found it extremely verbose to allocate objects and call their methods. I couldn't find something in the documentation about that, so curious. Thank you
n
You will need to write something in C++ that interacts with the C++ library, and provides a C API that is Kotlin Native compatible.
a
@napperley, I'm not sure I'm following. Wouldn't it be easier if we could translate to C++ classes instead of struct with function pointers for everything? I also tried to have a different API at the Kotlin Native level / nativeMain but it didn't help make the surface API easier to consume from a C++ stand point.
d
Some form of direct interoperability with C++ is in the Kotlin roadmap. For now it can only interop with C (and Objective-C but that's not really relevant here). https://kotlinlang.org/roadmap.html
❤️ 1