You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/topics/native/mapping-primitive-data-types-from-c.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
<p>This is the first part of the <strong>Mapping Kotlin and C</strong> tutorial series.</p>
5
5
<p><img src="icon-1.svg" width="20" alt="First step"/> <strong>Mapping primitive data types from C</strong><br/>
6
6
<img src="icon-2-todo.svg" width="20" alt="Second step"/> <a href="mapping-struct-union-types-from-c.md">Mapping struct and union types from C</a><br/>
7
-
<img src="icon-3-todo.svg" width="20" alt="Third step"/> <a href="mapping-function-pointers-from-c.md">Mapping function pointers</a><br/>
7
+
<img src="icon-3-todo.svg" width="20" alt="Third step"/> <a href="mapping-function-pointers-from-c.md">Mapping function pointers</a><br/>
8
8
<img src="icon-4-todo.svg" width="20" alt="Fourth step"/> <a href="mapping-strings-from-c.md">Mapping strings from C</a><br/>
9
9
</p>
10
10
</tldr>
@@ -18,8 +18,8 @@
18
18
>
19
19
{style="warning"}
20
20
21
-
In this tutorial, you'll learn which C data types are visible in Kotlin/Native and vice versa and explore the advanced
22
-
C interop-related usages of Kotlin/Native and [multiplatform](gradle-configure-project.md#targeting-multiple-platforms)
21
+
Let's explore which C data types are visible in Kotlin/Native and vice versa and examine advanced
22
+
C interop-related use cases of Kotlin/Native and [multiplatform](gradle-configure-project.md#targeting-multiple-platforms)
23
23
Gradle builds.
24
24
25
25
In this tutorial, you'll:
@@ -120,7 +120,7 @@ To create project files:
120
120
121
121
<tabs group="build-script">
122
122
<tab title="Kotlin" group-key="kotlin">
123
-
123
+
124
124
```kotlin
125
125
plugins {
126
126
kotlin("multiplatform") version "%kotlinVersion%"
@@ -150,10 +150,10 @@ To create project files:
150
150
distributionType = Wrapper.DistributionType.BIN
151
151
}
152
152
```
153
-
153
+
154
154
</tab>
155
155
<tab title="Groovy" group-key="groovy">
156
-
156
+
157
157
```groovy
158
158
plugins {
159
159
id 'org.jetbrains.kotlin.multiplatform' version '%kotlinVersion%'
@@ -184,13 +184,13 @@ To create project files:
184
184
distributionType = 'BIN'
185
185
}
186
186
```
187
-
187
+
188
188
</tab>
189
189
</tabs>
190
190
191
-
The project file configures the C interop as an additional build step.
192
-
Check out the [Multiplatform Gradle DSL reference](multiplatform-dsl-reference.md) to learn about different
193
-
ways you can configure it.
191
+
The project file configures the C interop as an additional build step.
192
+
Check out the [Multiplatform Gradle DSL reference](multiplatform-dsl-reference.md) to learn about different
193
+
ways you can configure it.
194
194
195
195
2. Move your `interop.def`, `lib.h`, and `lib.def` files to the `src/nativeInterop/cinterop` directory.
196
196
3. Create a `src/nativeMain/kotlin` directory. This is where you should place all the source files, following Gradle's
@@ -218,10 +218,10 @@ You'll complete the code later as you learn how C primitive type declarations lo
218
218
219
219
## Inspect generated Kotlin APIs for a C library
220
220
221
-
Let's see how C primitive types are mapped into Kotlin/Native and update the example project accordingly.
221
+
Let's see how C primitive types are mapped into Kotlin/Native and update the example project accordingly.
222
222
223
-
With the help of IntelliJ IDEA's [Go to declaration](https://www.jetbrains.com/help/rider/Navigation_and_Search__Go_to_Declaration.html)
224
-
command (<shortcut>Cmd + B</shortcut>/<shortcut>Ctrl + B</shortcut>), you can navigate to the following generated API
223
+
Use the IntelliJ IDEA's [Go to declaration](https://www.jetbrains.com/help/rider/Navigation_and_Search__Go_to_Declaration.html)
224
+
command (<shortcut>Cmd + B</shortcut>/<shortcut>Ctrl + B</shortcut>) to navigate to the following generated API
225
225
for C functions:
226
226
227
227
```kotlin
@@ -250,7 +250,7 @@ signed value:
250
250
251
251
Now that you've seen the C definitions, you can update your Kotlin code. The final code in the `hello.kt` file may look
252
252
like this:
253
-
253
+
254
254
```kotlin
255
255
importinterop.*
256
256
importkotlinx.cinterop.ExperimentalForeignApi
@@ -265,7 +265,7 @@ fun main() {
265
265
}
266
266
```
267
267
268
-
To verify that everything works as expected, run the `linkDebugSharedNative` Gradle task [in your IDE](native-get-started.md#build-and-run-the-application)
268
+
To verify that everything works as expected, run the `runDebugExecutableNative` Gradle task [in your IDE](native-get-started.md#build-and-run-the-application)
0 commit comments