In a bit of a Multiplatform design quandary. I am ...
# multiplatform
n
In a bit of a Multiplatform design quandary. I am maintaining a Kotlin Native library that currently supports two Linux targets (linuxX64 & linuxArm32Hfp). The maintained library uses a C library as a base (dependency), however there are some parts of the dependency which are only applicable to some Unix based targets (eg Linux). Initially I was looking at having the Unix bits shared in the common module, however that would mean it would need to be available for all platform modules which won't work if a new platform module is added that isn't Unix based. Kotlin 1.5.20 will have the new platform code sharing feature however that would only cover a single platform. Is there a way cover the code sharing for Unix based targets scenario?
r
HMPP seems like exactly what you're looking for: https://kotlinlang.org/docs/mpp-share-on-platforms.html#share-code-on-similar-platforms Just make a
unix
target above the two linux ones
m
In 1.5.20 commonizer is improved, but still have issues for platforms with different bitness, see still unresolved https://youtrack.jetbrains.com/issue/KT-46636
n
Looks like the feature is being pushed out to Kotlin 1.5.30.