Questions tagged [cinterop]

29 questions
0
votes
1 answer

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 success or failure. The actual value that was read is…
digory doo
  • 1,978
  • 2
  • 23
  • 37
0
votes
0 answers

Is it possible to use C code with cinterop in a Kotlin/Native Apple framework?

The goal is to use a C library in iOS trough Kotlin/Native. Is this possible? Thank you.
0
votes
0 answers

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; bool b; ... } In C++ world it has associated…
user1668604
  • 431
  • 2
  • 11
0
votes
2 answers

Kotlin multiplatform project depending on another one with cocoapods

I have a kotlin multipltform library which has several cocoapods cocoapods { .... pod("gRPC/GRPCCore", grpcVersion) pod("gRPC-ProtoRPC", grpcVersion) pod("Protobuf", "3.15.8") // etc } I published this library to artifactory…
Maurycy
  • 3,911
  • 8
  • 36
  • 44
0
votes
1 answer

cinterop process finished with non-zero exit value 1

I am experimenting with kotlin multiplatform in this chess app. I have c++ code for the chess engines in the app. For each engine, I want to create a kmm module. Since kotlin native does not yet interop with c++, I have to create wrappers around the…
nwagu
  • 532
  • 3
  • 17
0
votes
0 answers

Kotlin-Native CompileKotlinIos task fails beacuse Cinterop task can not update when I change Objective-C code

@Kevin Galligan My company has a iOS project using Kotlin-Native, and I add a cinterop to the project like this in build.gradle.kts: val CommonInterop by cinterops.creating { defFile(project.file("${commonBridgePath}/CommonBridge.def")) …
yuzhiyun
  • 41
  • 3
0
votes
1 answer

How to install cinterop tool in Windows/Ubuntu

I am following this tutoriel to use C library in Kotlin (Android Studio) https://jonnyzzz.com/blog/2018/05/28/minimalistic-kn/ But I can’t find the how to install/download the cinterop tool both in Windows and Ubuntu I have the error “cinterop:…
0
votes
0 answers

C API for a Swift framework – always exposed?

I am building a iOS SDK in Swift 5.3, and I define all classes (except the documented API) as internal (i.e. using the default access wherever I cannot use private). The SDK is distributed as a cocoapod dynamic framework. So far so good. My SDK has…
Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
0
votes
1 answer

How to create CPointer of primitive data type in Kotlin/Native?

Allocating and obtaining a pointer of a struct is quite simple: memScoped { val str: StructType = alloc() val strPtr: CPointer = str.ptr } But I'm struggling to allocate or get pointer of the Int, UInt, Long, ULong…
Animesh Sahu
  • 7,445
  • 2
  • 21
  • 49
0
votes
1 answer

Can't create the OSLog activity on Swift

I want to use the OSLog activities to structure my logs but I stuck with a problem of absence needed activity constants on Swift such as OS_ACTIVITY_CURRENT and OS_ACTIVITY_NONE and I have an error when I try to create an activity: let activity =…
iUrii
  • 11,742
  • 1
  • 33
  • 48
0
votes
1 answer

Why can't I import Glibc in a Swift Jupyter Notebook?

When I execute: import Glibc as the first line in my notebook running on a fresh Ubuntu 18.04 GCE VM, I get the following error message: expression failed to parse, unknown error
0
votes
1 answer

kotlin native cinterop add linkerOpts of source code

I add one header file and its source to my xcode project. For example , AddToo.h @interface AddTool : NSObject -(NSString*) test:(NSString*) string; @end And the follow is source code @implementation AddTool -(NSString*) test:(NSString*) string…
Liu Tom
  • 397
  • 2
  • 9
0
votes
0 answers

DWARF error: mangled line number section when trying to include secext.h in Kotlin/Native cinterop

I tried including secext.h winapi header in Kotlin/Native cinterop using Gradle: build.gradle: // ... kotlin { mingwX64("windows") { compilations.main { cinterops { secext { packageName…
TheChilliPL
  • 337
  • 1
  • 5
  • 14
0
votes
1 answer

Kotlin/Native cinterop: compilerOpts inside .def file vs compilerOpts inside gradle

In documentation of cinterop for Kotlin/Native, you have to define a .def file such as: language = Objective-C modules = FirebaseCore compilerOpts = -framework FirebaseCore linkerOpts = -framework FirebaseCore Now you could also specify a…
Archie G. Quiñones
  • 11,638
  • 18
  • 65
  • 107
1
2