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

Konstantin Tskhovrebov

10/05/2023, 4:26 PM
Have you known that KDoctor may check your concrete project? Just run
kdoctor -a
inside the project root and see a report! 👨‍⚕️
🔥 5
p

Pablichjenkov

10/05/2023, 4:52 PM
Is it still checking cocoapods as a requirement? Even the official template move away from cocoa
j

Jacob Ras

10/05/2023, 5:02 PM
Yes, I know KDoctor and I've built iOS KMP projects before on Mac hardware. I will try to make my question more specific: what kind of iOS stuff is being compiled when my library doesn't output any Cocoapod? The docs state the Kotlin code gets compiled into: > "a
*.klib
library artifact, which can be consumed by Kotlin/Native itself as a dependency but cannot be executed or used as a native library"
So this klib seems like an intermediate format that knows about my targets but cannot be executed on its own. Like a
.jar
, it seems to me. Later, when used in an actual KMP project that outputs an iOS framework, the actual iOS code gets compiled. But it seems it's already doing some iOS compilation before that, else I would be able to compile it on my Windows machine. Is there perhaps some documentation on the Klib format?
a

a-dd

10/05/2023, 5:12 PM
p

Pablichjenkov

10/05/2023, 5:45 PM
I have been sneaking through the .klibs generated for native targets and it seems to ship binary code, perhaps llvm bitcode, in the .knm files. Those binaries have to be compiled when building the library since there is no intermediate kotlin dialect as Artem mentioned.
thank you color 1
j

Jacob Ras

10/05/2023, 6:14 PM
Thanks @Pablichjenkov, that's what I'm looking for :-) When I read the docs I looked like klib was just a bundle of Kotlin code, already split in different source sets, but to compile later in projects with actual executables as output. So it actually already contains compiled target code. Are those klibs/knms easy to read? I might give the K/N compiler a go to see exactly what it outputs
p

Pablichjenkov

10/05/2023, 6:22 PM
I can read the function and classes symbols name clearly. That is the purpose of it I guess, they will be used by the linker later on when packaging the final App binary. Now some files contain binary that my editor doesn't pick up. You will need a binary editor to read those
👍 1
2 Views