Kotlin native can be compiled into objective/swift...
# getting-started
t
Kotlin native can be compiled into objective/swift. but not c#, any reason for that?
🧵 3
j
It compiles into objective-c so that it can be used as a framework in the iOS application, I'm not sure what use case there would be to compile to C#. C# isn't necessary to run on any platform
t
Yes. It's not necessary to use C# even in windows. But this is not related with my question. Is is very hard to compile it into c# than objective c?
Ktor doesn't support windows too.
j
🤷 I'd be curious to know what the roadmap for that is. I was unaware there isn't native windows support outside of the JVM
This was just released and includes some useful info I believe https://blog.jetbrains.com/kotlin/2023/02/update-regarding-kotlin-native-targets/
t
1. mingwX86 – Support for this target requires a lot of resources while user demand remains low. Furthermore, mingwX64 is better suited for the majority of known use cases anyway.
So windows support is quite harder than other platforms. I'd like to know the reasons
Try to ask chatgpt
23cd82c3898c6ef537c47821712ca73.png
@Josh Eldridge
j
Good to know
l
Note that dropping mingwx86 doesn't drop support for windows as a whole, but just 32 bit support. 64 bit windows is supported using mingwx64.
👍 3
To support C# interop directly, we'd need a new backend that compiles to C#'s binary format, similar to Java bytecode. This would be easier after K2 is out, but still a lot of work.
👍 1
d
What is the motivation to support compilation of Kotlin code to CIL and C# interop?
👆 1
a
@to-elixir you might find some more technical information in the project docs https://github.com/JetBrains/kotlin/blob/master/kotlin-native/README.md
t
@dmitriy.novozhilov About your feedback: What is the motivation to support compilation of Kotlin code to CIL and C# interop? The same question I can ask too: What is the motivation to support compilation of Kotlin code to Objective C/Swift? Why not just compile into C native in mac too? People can create app in mac by C/C++. right? So that's my question. if it can support objective c/swift. why not support c# too?
d
What is the motivation to support compilation of Kotlin code to Objective C/Swift?
It is simple: multiplatform mobile developement Also this statement is not fully correct. K/Native does not compile into Objective C. It compiles into LLVM bitcode, which then compiled into native libs, which can be called from any native language, like C, C++, Objective C, Swift and even Rust (I didn't tried but it should work) On the other hand C# is compiled into CIL, which implies quite a lot of work for the team. Compiler should understand CIL libraries and be able to produce CIL bytecode. And effort of it is unknown. How many C# developers want to write in Kotlin instead of C#? What Kotlin can suggest to C# developers?
t
@dmitriy.novozhilov Got it. The project that I'm doing should support ios/mac/android/windows. These platforms have some common code which should be shared. and each platform have some individual implementation. And it's easier and more productivity to use c# on windows for some reasons. For instance. encryption/decryption logic, scan bluetooth ble. And now I use some bridge way to call C functions which is produced by kotlin native from c#.
So the motivation to support c# is: It's more productivity and easier by c# than C native.
d
I understand that such usecases exist. But Kotlin team has limited resources, and we need to manage it carefully. How many Kotlin users would be happier if we implement C# interop? Or it's better to focus on improving existing plarforms? At this moment not sparing resources on new platforms feels more reasonable