When generating a dynamic library, how can you in include the classes from a dependent library in the generated C header?

I have a multi-module project. And in the module i use to generate a dynamic library I include project (‘:data’) as a dependency. I can generate it either

with the konan plugin:

apply plugin: 'konan'

konan.targets = ['macbook', 'linux']

konanArtifacts {
    // Build a dynamic library
    dynamic('dLibrary') {
             libraries {
                 allLibrariesFrom project(':data')
             }
    }
}

or the new kotlin-platform-native plugin:

apply plugin: 'kotlin-platform-native'

dependencies {
     implementation project(':data')
 }

sourceSets {
    main {
        component {
            outputKinds = [ KLIBRARY ]
            extraOpts '-p', 'dynamic', '-module_name', baseName.get()
        }
     }
 }

but either way the generated c header files does not include classes from project(‘:data’)

is there any way I can specify to include classes from a dependency in the header? I would like to be able to access classes from project(‘:data’) from c.

I have tried generating a second dylib for :data, but at runtime *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Only one Kotlin framework can be loaded currently' is thrown

1 Like