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
napperley
11/03/2020, 2:41 AM
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
Arnaud Vallat
11/05/2020, 8:12 PM
@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
Derek Ellis
11/06/2020, 1:10 AM
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