With the Kotlin Native documentation it would be g...
# kotlin-native
n
With the Kotlin Native documentation it would be good to have an article that provides guidance on how to wrap/manage C libraries with Kotlin Native libraries (especially if multiple related libraries are involved). Using the LVGL KT ( https://gitlab.com/embed-soft/lvgl-kt ) libraries as an example they are structured like the following:
Copy code
Core (depends on LVGL C lib); targets linuxX64 & linuxArm32Hfp
  |> Drivers (depends on LVGL & LV Drivers C libs); targets linuxX64 & linuxArm32Hfp
        |> SDL 2 (depends on LV Drivers & SDL 2 C libs); targets linuxX64
If the LVGK KT Widgets library existed then the structure would look like this:
Copy code
Core (depends on LVGL C lib); targets linuxX64 & linuxArm32Hfp
  |> Widgets (depends on LVGL C lib); targets linuxX64 & linuxArm32Hfp
  |> Drivers (depends on LVGL & LV Drivers C libs); targets linuxX64 & linuxArm32Hfp
        |> SDL 2 (depends on LV Drivers & SDL 2 C libs); targets linuxX64
Apparently there is an issue where Kotlin compiler caching can fail when the same C library is used in multiple Kotlin Native libraries that are used by a Kotlin Native program: https://youtrack.jetbrains.com/issue/KT-51190
👍🏼 1
👍 3
💯 3
There was a suggestion made to use a single Kotlin Native library instead of multiple Kotlin Native libraries, however that wouldn't work. For example, LVGL KT SDL 2 publicly exposes its APIs, but doesn't publicly expose the LVGL KT Drivers APIs. If a Kotlin Native program uses the SDL 2, Core, and Drivers APIs then three dependencies would need to be declared in the Gradle build file.