r4zzz4k
09/13/2018, 2:06 PMdepends directive of .def file? I was skimming through the repo but didn't find any usage outside of default platform libs generation.
Reasoning for the question: I'm trying to consume from Kotlin/Native two C libraries which depend on each other. Bindings for the first one are generated trivially, but I'm unable to inform cinterop that for types and functions from the first library there should be imports with first lib wrapper's namespace instead of duplicated bridges.svyatoslav.scherbina
09/13/2018, 2:42 PMdepends property value should contain space-separated list of library names. This names are resolved as described in the documentation: https://github.com/JetBrains/kotlin-native/blob/master/LIBRARIES.md#library-search-sequencer4zzz4k
09/13/2018, 3:21 PMcinterop uses this property only to add these to final .klib dependencies, but not to actually emit any stubs code?
For example, platform.linux depends on platform.posix and there is, for example, the following function:
kfun:platform.linux.inet_makeaddr(<http://kotlin.Int;kotlin.Int|kotlin.Int;kotlin.Int>)kotlinx.cinterop.CValue<platform.posix.in_addr>. So function from platform.linux contains reference to type from platform.posix. I'm trying to achieve the same thing, but for me cinterop for the second library generates all the types for the second time under new package instead of referencing them from the first klib. I've enumerated all the headers of the second library in headerFilter and mentioned the first one in depends, but it's not working for me, unfortunately.r4zzz4k
09/13/2018, 4:09 PMapt install libglib2.0-dev libgirepository1.0-dev.
Resulting `gir_interop-build/manifest.properties`contains proper depends= field, everything else seems okay there, but both gobj_interop-build/kotlin/sample/gobj/cinterop/cinterop.kt and gir_interop-build/kotlin/sample/gir/cinterop/cinterop.kt contain their own definition of class _GObject(rawPtr: NativePtr) : CStructVar(rawPtr) { under corresponding packages, when I'm trying to achieve one class as sample.gobj.cinterop._GObject and for second library import sample.gir.cinterop.* or something along those lines instead.msink
09/13/2018, 5:48 PM-library gobj option needed for second cinteropr4zzz4k
09/13/2018, 5:52 PMplatformLibs/build.gradle clearly does take depends from DefFile and passes it as libraries to interop configuration. Thank you, it works!r4zzz4k
09/13/2018, 5:56 PMsvyatoslav.scherbina
09/14/2018, 7:07 AM-library options to cinterop it doesn’t seem necessary to add depends = to .def file.
Though it seems kind of logical to do that by cinterop itself than by external Gradle taskWhat do you mean?
cinterop itself supports dependencies between C libraries through -library option.r4zzz4k
09/14/2018, 7:17 AMdepends is necessary in presence of -library.
So let me ask another question: what are use cases for having depends field without -library flag? If I understand correctly, it would create dependency without providing any actual communication between libraries.r4zzz4k
09/14/2018, 7:23 AMplugin-base with registration and plugin API functions
• plugin-a with -library plugin-base
• app with -library plugin-base and depends plugin-a for statically embedding it into the final artifact.
This way app does use actual plugin, but via common dependency. So disregard that, it's perfectly fine to have it the way you do, it was just my misunderstanding.svyatoslav.scherbina
09/14/2018, 7:58 AMwhat are use cases for havingCurrentlyfield withoutdependsflag?-library
depends is for internal use only, e.g. to prepare platform libs.r4zzz4k
09/14/2018, 7:59 AM