When compiling a multiplatform library for android...
# multiplatform
a
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
looping on this , want to know more about multiplatform plugin
l
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
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
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.