Skip to content

Commit

Permalink
update: first mapping tutorial revamp (#4708)
Browse files Browse the repository at this point in the history
  • Loading branch information
danil-pavlov authored Feb 28, 2025
1 parent 7b416a9 commit b4b6c58
Show file tree
Hide file tree
Showing 7 changed files with 270 additions and 252 deletions.
4 changes: 2 additions & 2 deletions docs/topics/native/apple-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ In this tutorial, you will:
* [Use the framework from Swift](#use-code-from-swift)

You can use the command line to generate a Kotlin framework, either directly or with a script file (such as `.sh` or `.bat` file).
However, this approach doesn't scale well for big projects that have hundreds of files and libraries.
However, this approach doesn't scale well for larger projects that have hundreds of files and libraries.
Using a build system simplifies the process by downloading and caching the Kotlin/Native
compiler binaries and libraries with transitive dependencies and run the compiler and tests.
compiler binaries and libraries with transitive dependencies, as well as by running the compiler and tests.
Kotlin/Native can use the [Gradle](https://gradle.org) build system through the [Kotlin Multiplatform plugin](gradle-configure-project.md#targeting-multiple-platforms).

> If you use a Mac and want to create and run applications for iOS or other Apple targets, you also need to
Expand Down
30 changes: 17 additions & 13 deletions docs/topics/native/mapping-function-pointers-from-c.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
[//]: # (title: Mapping function pointers from C – tutorial)

<tldr>
<p>This is the third part of the <strong>Mapping Kotlin and C</strong> tutorial series.</p>
<p><img src="icon-1-done.svg" width="20" alt="First step"/> <a href="mapping-primitive-data-types-from-c.md">Mapping primitive data types from C</a><br/>
<img src="icon-2-done.svg" width="20" alt="Second step"/> <a href="mapping-struct-union-types-from-c.md">Mapping struct and union types from C</a><br/>
<img src="icon-3.svg" width="20" alt="Third step"/> <strong>Mapping function pointers</strong><br/>
<img src="icon-4-todo.svg" width="20" alt="Fourth step"/> <a href="mapping-strings-from-c.md">Mapping strings from C</a><br/>
</p>
</tldr>

> The C libraries import is [Experimental](components-stability.md#stability-levels-explained).
> All Kotlin declarations generated by the `cinterop` tool from C libraries
> should have the `@ExperimentalForeignApi` annotation.
Expand All @@ -9,12 +18,8 @@
>
{style="warning"}

This is the third post in the series. The very first tutorial is
[Mapping primitive data types from C](mapping-primitive-data-types-from-c.md). There are also
[Mapping struct and union types from C](mapping-struct-union-types-from-c.md) and
[Mapping strings from C](mapping-strings-from-c.md) tutorials.
In this tutorial, you'll learn how to:

In this tutorial We will learn how to:
- [Pass Kotlin function as C function pointer](#pass-kotlin-function-as-c-function-pointer)
- [Use C function pointer from Kotlin](#use-the-c-function-pointer-from-kotlin)

Expand Down Expand Up @@ -259,13 +264,12 @@ fun main() {
}
```
## Next Steps
## Next step
In the next part of the series, you'll learn how strings are mapped between Kotlin and C:

**[Proceed to the next part](mapping-strings-from-c.md)**

Continue exploring more C language types and their representation in Kotlin/Native
in next tutorials:
- [Mapping primitive data types from C](mapping-primitive-data-types-from-c.md)
- [Mapping struct and union types from C](mapping-struct-union-types-from-c.md)
- [Mapping strings from C](mapping-strings-from-c.md)
### See also

The [C Interop documentation](native-c-interop.md)
covers more advanced scenarios of the interop.
Learn more in the [Interoperability with C](native-c-interop.md) documentation that covers more advanced scenarios.
Loading

0 comments on commit b4b6c58

Please sign in to comment.