|
1 | 1 | [//]: # (title: Platform libraries)
|
2 | 2 |
|
3 |
| -To provide access to user's native operating system services, |
4 |
| -Kotlin/Native distribution includes a set of prebuilt libraries specific to |
5 |
| -each target. We call them **Platform Libraries**. |
| 3 | +* Kotlin/Native |
| 4 | + * **Platform Libraries** |
| 5 | + * == prebuilt libraries |
| 6 | + * specific / EACH target |
| 7 | + * -- provide access to -- user's native OS services |
6 | 8 |
|
7 | 9 | ### POSIX bindings
|
8 | 10 |
|
9 |
| -For all Unix- or Windows-based targets (including Android and |
10 |
| -iOS targets) we provide the POSIX platform lib. It contains bindings |
11 |
| -to platform's implementation of the [POSIX standard](https://en.wikipedia.org/wiki/POSIX). |
| 11 | +* POSIX platform lib |
| 12 | + * uses |
| 13 | + * 👀| ALL Unix- or Windows-based targets (ALSO included Android & iOS)👀 |
| 14 | + * ❌NOT available | [WebAssembly](https://en.wikipedia.org/wiki/WebAssembly)❌ |
| 15 | + * == bindings -- to -- platform's implementation of the [POSIX standard](https://en.wikipedia.org/wiki/POSIX) |
| 16 | + * how to use it? |
12 | 17 |
|
13 |
| -To use the library, just import it: |
| 18 | + ```kotlin |
| 19 | + import platform.posix.* |
| 20 | + ``` |
14 | 21 |
|
15 |
| -```kotlin |
16 |
| -import platform.posix.* |
17 |
| -``` |
18 |
| - |
19 |
| -The only target for which it is not available is [WebAssembly](https://en.wikipedia.org/wiki/WebAssembly). |
20 |
| - |
21 |
| -Note that the content of `platform.posix` is NOT identical on |
22 |
| -different platforms, in the same way as different POSIX implementations |
23 |
| -are a little different. |
| 22 | + * `platform.posix`'s content != / platforms |
| 23 | + * Reason: 🧠== differences / POSIX implementations 🧠 |
24 | 24 |
|
25 | 25 | ### Popular native libraries
|
26 | 26 |
|
27 |
| -There are many more platform libraries available for host and |
28 |
| -cross-compilation targets. Kotlin/Native distribution provides access to |
29 |
| -OpenGL, zlib and other popular native libraries on |
30 |
| -applicable platforms. |
31 |
| - |
32 |
| -On Apple platforms, `objc` library is provided for interoperability with [Objective-C](https://en.wikipedia.org/wiki/Objective-C). |
33 |
| - |
34 |
| -Inspect the contents of `dist/klib/platform/$target` of the distribution for the details. |
| 27 | +* Kotlin/Native |
| 28 | + * provides access to |
| 29 | + * OpenGL, |
| 30 | + * zlib |
| 31 | + * others |
| 32 | + * _Example:_ | Apple platforms, `objc` library -- is provided for -- interoperability with [Objective-C](https://en.wikipedia.org/wiki/Objective-C) |
| 33 | + * see the contents of `dist/klib/platform/$target` |
35 | 34 |
|
36 | 35 | ## Availability by default
|
37 | 36 |
|
38 |
| -The packages from platform libraries are available by default. No |
39 |
| -special link flags need to be specified to use them. Kotlin/Native |
40 |
| -compiler automatically detects which of the platform libraries have |
41 |
| -been accessed and automatically links the needed libraries. |
| 37 | +* platform libraries' packages are available by default |
| 38 | + * == NO need special link flags to use them |
| 39 | + * Reason: 🧠 Kotlin/Native compiler -- automatically detects the -- platform libraries / have been accessed -> links the libraries |
42 | 40 |
|
43 |
| -On the other hand, the platform libs in the distribution are merely |
44 |
| -just wrappers and bindings to the native libraries. That means the |
45 |
| -native libraries themselves (`.so`, `.a`, `.dylib`, `.dll` etc) |
46 |
| -should be installed on the machine. |
| 41 | +* platform libs | distribution == wrappers & bindings to the native libraries |
| 42 | + * == native libraries themselves (`.so`, `.a`, `.dylib`, `.dll` etc) -- should be -- installed | machine |
0 commit comments