https://kotlinlang.org logo
a

Aditya Kurkure

07/16/2022, 9:06 AM
When compiling a multiplatform library for android what happens under the hood? Does the compiler compile
commonMain
and
AndroidMain
the same way any normal multi module android library written in kotlin is compiled or are there any other changes that the multiplatform plugin adds?
👀 1
2
a

Ayush Bansal

07/17/2022, 7:23 AM
looping on this , want to know more about multiplatform plugin
l

Landry Norris

07/18/2022, 2:11 PM
I haven’t noticed any changes, and I’ve been using the same description you gave when describing how it works to others, but other than the obvious expect/actual mechanism, I think the description is accurate.
🙏 1
a

Aditya Kurkure

07/18/2022, 6:53 PM
Even for the expect actual mechanism what would the file in commonMain be treated just like an interface? Because if it isn't then the compiler may be combining the
commonMain
and
androidMain
at into one. :/
l

Landry Norris

07/18/2022, 7:12 PM
I looked at the compiler source code once, but didn't study it too well. It looks like it does a Validation check on the expect/actuals to make sure they match, then does another pass where it essentially inlines the actual declaration. I'm not 100% sure this is exactly how it works, but that's what I could tell.