https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
k

Kris Wong

03/09/2020, 9:21 PM
has anyone tried to use maven for .kilbs from a project with a cinterop?
there's a .klib file for the cinterop, but I don't know how to reference it
apparently the consuming project must also link the same framework
k

kpgalligan

03/09/2020, 10:02 PM
The interop doesn’t include the code you want to interop with. You need to link that separately. I assume some folks directly include objc and c with their projects, and I’d like to understand that better, but haven’t needed it.
k

Kris Wong

03/10/2020, 1:00 PM
I am wondering what the best practice is in that case, because I need the same framework linked into to KMP modules, one of which is consuming the other from maven
it seems kind of hokey to consume a module from an artifact repo, and then have to come up with some other mechanism to bring in its framework dependencies
k

kpgalligan

03/10/2020, 1:06 PM
The kmp module(s) aren’t exactly “linking” as I understand it. They’re generating kotlin from the headers. In the firestore sample, I have some of the framework copied into the repo, but really just need the headers. The actual “linking” happens when trying to build the app itself on ios. I don’t have a general answer for you. I’m not an expert on interop config as I’ve mostly avoided it. However, I would say, for things like Crashlytics, if you somehow dragged the framework in through kotlin, the config in xcode would probably be a lot worse and/or you’d need to call the framework through Kotlin, which would be frustrating for the iOS/Swift people. But yes, interop config can be not fun.
k

Kris Wong

03/10/2020, 1:11 PM
yes, cinterop generates the bindings from he headers. but for that reason it needs to be linked as well. but then it also needs to be linked into the umbrella framework, and then again the ultimate iOS app.