Questions tagged [cinterop]
The cinterop tag has no usage guidance.
cinterop
35
questions
0
votes
1
answer
27
views
Kotlin Multiplatform objective-c export file name convention
What logic is used to create class and protocol names when Kotlin code is exported to Objective-C? Additionally, where can I find detailed information about this process?
Where code like:
package ...
0
votes
0
answers
19
views
getOriginalKotlinClass returns null even though the class exists
I'm working on a Kotlin Multiplatform app with multiple modules.
I use Koin for dependency injection.
This is the structure of the project:
MyApp
├── ...
└── shared
├── injection
└── modulea
...
0
votes
1
answer
41
views
How to convert a List or Array to C Array in Kotlin/Native
Given an array Array<VkDeviceQueueCreateInfo> I want to convert it to a C Array of C values (or pointer to the first item), i. e. VkDeviceQueueCreateInfo*.
This is where I'm getting a type ...
0
votes
0
answers
18
views
How to convert CValues to List in Kotlin/Native (or iterate)?
I have a CValues<VkLayerProperties> which is passed to a C function so that it can fill the array.
val layerProperties = createValues<VkLayerProperties>(layerCount.value.toInt()) {}
...
0
votes
0
answers
25
views
Memoryleaks when using kotlin classes inside c
I am working on a kotlin multiplatform framework that can be used on android an linux (with native c interop.
Both worlds shared classes, that are part of the commonMain.
For example I have this ...
0
votes
1
answer
62
views
Kotlin/Native Cinterop With libxml2 - Corrupted XPath Expression
Versions
Kotlin 1.9.22
libxml 2.9.14+dfsg-1.3
OS: Ubuntu 23.10
The Problem
In a small Kotlin/Native application I use cinterop with libxml2 to evaluate a set of XPath expressions to extract element ...
0
votes
0
answers
178
views
How to distribute iOS framework dependency in kotlin multiplatform library? What are my options?
I am creating KMP library and looking for the options how to solve following. On iOS part I am using some 3rd party framework to delegate some work and do some computations.
I was able to succesfully ...
0
votes
1
answer
108
views
How do you define a =copy hook for a distinct-cstring-type in nim?
For interacting with the GTK library I call some functions that hand me a c-string (char*) that my code owns going forward.
I want to have those strings in a custom distinct cstring type and define a =...
1
vote
0
answers
20
views
In Kotlin Multiplatform, using gradle.kts, how do I determine the compilers used for targets like linuxX64, mingwX64, and mac/ios?
I need to know what compilers are being used so I can compile my C++ code with them.
I tried using the standard host compilers (for when the target == my host) and it did not work due to undefined ...
2
votes
2
answers
100
views
Access tuple (defined by libc) using an index
I understand that Swift tuples cannot be indexed at runtime. However, I'm working with the POSIX terminal interface (defined by <termios.h>, which is part of libc).
In the C code, we are able to ...
2
votes
1
answer
99
views
How to send a `vararg variadicArguments: kotlin.Any?` to a GObject native call with Kotlin Native?
I'm working on a GIR generator to create Kotlin Native bindings for GTK and other GObject based libraries. I reached a stage where I can almost compile the bindings for GLib but I'm stuck with the ...
1
vote
1
answer
350
views
How can I build a libcurl Kotlin Native application on Windows?
I'm relatively new to Kotlin Native, and to learn more about it, I am studying these two tutorials, one from the official JetBrains documentation and the other from the jonnyzzz blog, both focused on ...
0
votes
1
answer
464
views
Pass value from Kotlin/native to C
How do I pass a value from Kotlin to C as an int* and receive the written value? The C function looks like this:
int readValue(long param, int *value);
The return value is just 1 or 0 indicating ...
1
vote
2
answers
401
views
Kotlin/Native : How to import entire GTK4 Libs and headers to Kotlin Native C Interop?
I am learning C Interop with Kotlin Native. I successfully imported my sample C program using .Def file and executed the code in kotlin
So, I am thinking about import GTK4 libs, which is in C, to ...
0
votes
0
answers
78
views
How to store C++ objects in C structs?
I have a C++ API that is exposed to other languages via C API.
Suppose there is this C struct the array of which needs to be exposed via C API.
struct SomeCStruct {
// C compatible types
int i;
...