From 6e71902b4588a21297cd752008c9be15d0be5c26 Mon Sep 17 00:00:00 2001 From: alfredo-toledano Date: Sat, 30 Nov 2024 22:04:52 +0100 Subject: [PATCH] doc(docs.topics.native.platformLibs): add notes --- docs/topics/native/native-platform-libs.md | 60 ++++++++++------------ 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/docs/topics/native/native-platform-libs.md b/docs/topics/native/native-platform-libs.md index 2861a2c8e2a..e780b71ecbb 100644 --- a/docs/topics/native/native-platform-libs.md +++ b/docs/topics/native/native-platform-libs.md @@ -1,46 +1,42 @@ [//]: # (title: Platform libraries) -To provide access to user's native operating system services, -Kotlin/Native distribution includes a set of prebuilt libraries specific to -each target. We call them **Platform Libraries**. +* Kotlin/Native + * **Platform Libraries** + * == prebuilt libraries + * specific / EACH target + * -- provide access to -- user's native OS services ### POSIX bindings -For all Unix- or Windows-based targets (including Android and -iOS targets) we provide the POSIX platform lib. It contains bindings -to platform's implementation of the [POSIX standard](https://en.wikipedia.org/wiki/POSIX). +* POSIX platform lib + * uses + * 👀| ALL Unix- or Windows-based targets (ALSO included Android & iOS)👀 + * ❌NOT available | [WebAssembly](https://en.wikipedia.org/wiki/WebAssembly)❌ + * == bindings -- to -- platform's implementation of the [POSIX standard](https://en.wikipedia.org/wiki/POSIX) + * how to use it? -To use the library, just import it: + ```kotlin + import platform.posix.* + ``` -```kotlin -import platform.posix.* -``` - -The only target for which it is not available is [WebAssembly](https://en.wikipedia.org/wiki/WebAssembly). - -Note that the content of `platform.posix` is NOT identical on -different platforms, in the same way as different POSIX implementations -are a little different. + * `platform.posix`'s content != / platforms + * Reason: 🧠== differences / POSIX implementations 🧠 ### Popular native libraries -There are many more platform libraries available for host and -cross-compilation targets. Kotlin/Native distribution provides access to -OpenGL, zlib and other popular native libraries on -applicable platforms. - -On Apple platforms, `objc` library is provided for interoperability with [Objective-C](https://en.wikipedia.org/wiki/Objective-C). - -Inspect the contents of `dist/klib/platform/$target` of the distribution for the details. +* Kotlin/Native + * provides access to + * OpenGL, + * zlib + * others + * _Example:_ | Apple platforms, `objc` library -- is provided for -- interoperability with [Objective-C](https://en.wikipedia.org/wiki/Objective-C) + * see the contents of `dist/klib/platform/$target` ## Availability by default -The packages from platform libraries are available by default. No -special link flags need to be specified to use them. Kotlin/Native -compiler automatically detects which of the platform libraries have -been accessed and automatically links the needed libraries. +* platform libraries' packages are available by default + * == NO need special link flags to use them + * Reason: 🧠 Kotlin/Native compiler -- automatically detects the -- platform libraries / have been accessed -> links the libraries -On the other hand, the platform libs in the distribution are merely -just wrappers and bindings to the native libraries. That means the -native libraries themselves (`.so`, `.a`, `.dylib`, `.dll` etc) -should be installed on the machine. +* platform libs | distribution == wrappers & bindings to the native libraries + * == native libraries themselves (`.so`, `.a`, `.dylib`, `.dll` etc) -- should be -- installed | machine