Kotlin Native Static Library Best Practices?

I’ve begun working on two libraries that are multi platform. Targeting down to native level. These are back end / server libs. For my use case generally running in containers. Both of which will include cinterops for external libraries.

These libraries are more than likely not to be on the system. I was going through the documentation and trying to figure out the best path forward for this. I see two options.

  • Customize the containers to include libraries
  • Or include them as static libraries.

Right now I’ve been cloning in the requisite libraries, and have a build script building out static libraries. With the cinterop pulling in that static file.

Is there a better way, or recommended setup. I saw gradle has a c plugin but had trouble getting that working.

Well, the best bet would be a custom server of yours able to serve those libraries. Your application at runtime will check if they are present, if not, downloads and installs them.

Maybe some sort of launcher would be advised. I had a similar problem with JNIs. I ended up with a custom server with Ktor serving those and installing them at runtime before loading them.