napperley
07/04/2019, 11:23 PM@kotlinx.cinterop.internal.CStruct public final class MQTTClient_message public constructor(rawPtr: kotlinx.cinterop.NativePtr /* = kotlin.native.internal.NativePtr */) : kotlinx.cinterop.CStructVar {
public companion object : kotlinx.cinterop.CStructVar.Type {
}
public final var dup: <http://kotlin.Int|kotlin.Int> /* compiled code */
public final var msgid: <http://kotlin.Int|kotlin.Int> /* compiled code */
public final var payload: kotlinx.cinterop.COpaquePointer? /* = kotlinx.cinterop.CPointer<out kotlinx.cinterop.CPointed>? */ /* compiled code */
public final var payloadlen: <http://kotlin.Int|kotlin.Int> /* compiled code */
public final val properties: paho_mqtt.MQTTProperties /* compiled code */
public final var qos: <http://kotlin.Int|kotlin.Int> /* compiled code */
public final var retained: <http://kotlin.Int|kotlin.Int> /* compiled code */
public final val struct_id: kotlinx.cinterop.CArrayPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */> /* = kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVarOf<kotlin.Byte>> */ /* compiled code */
public final var struct_version: <http://kotlin.Int|kotlin.Int> /* compiled code */
}
qlitzler
07/05/2019, 3:03 PMktor
. I am trying to add an ios target, and run into this exception when trying to build.
You can reproduce for yourself by checking out the feature/ios
branch of https://github.com/algolia/algoliasearch-client-kotlinfcosta
07/05/2019, 6:33 PMkotlin {
targets {
final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") ? presets.iosArm64 : presets.iosX64
fromPreset(iOSTarget, 'ios') {
binaries {
framework('client')
framework('test') {
compilation = compilations.test
linkerOpts += ['-framework', 'UIKit']
}
}
}
}
cocoapods {
// Configure fields required by CocoaPods.
summary = "chat-client"
homepage = "<https://github.com/felipehjcosta>"
pod('SocketRocket', '0.5.1')
pod('OHHTTPStubs')
}
}
Paul Idstein
07/06/2019, 10:54 AMgalex
07/08/2019, 10:17 AMJonas Bark
07/08/2019, 2:45 PMval commonMain by getting {
dependencies {
//....
api("dependency-group:dependency:version")
}
}
When I'm trying to run the linkDebugTestIosX64
gradle task I'm getting this error:
e: Compilation failed: Cyclic dependency in library graph for: /Users/boni/Documents/Programmieren/Kotlin/StihlBusiness/StihlBusiness/build/classes/kotlin/iosX64/main/Library
* Source files: StoreTest2.kt
* Compiler version info: Konan: 1.3.1 / Kotlin: 1.3.40
* Output kind: PROGRAM
Is there a way to debug this to get better information?josephivie
07/08/2019, 8:33 PMclass ClosureSleeve(val closure: () -> Unit) : NSObject() {
@ObjCAction
fun runContainedClosure() {
closure()
}
val selector: COpaquePointer? get() = Companion.selector
@ThreadLocal
companion object {
var selector: COpaquePointer? = sel_registerName("runContainedClosure")
fun printMethods(){
val instance = ClosureSleeve{}
val type = object_getClass(instance)
println("Now there are implementations:")
memScoped {
val sizeOutput = this.alloc<UIntVar>()
println("My class: ${type}")
val mlist = class_copyMethodList(type, sizeOutput.ptr)
if(mlist == null){
println("Failed to pull selectors, null response.")
return@memScoped
}
val size = sizeOutput.value.toInt()
println("Selector size: $size")
for (i in 0 until size) {
println("Method $i: ${sel_getName(method_getName(mlist[i]))?.toKString()}")
}
}
println("Attempted registry: $selector")
println("End selectors.")
}
}
}
I'm then using it from Swift to keep that section isolated:
let sleeve = ClosureSleeveKt.makeSleeve {
print("Test")
}
print("Sleeve: \(sleeve)")
self.sleeve = sleeve //Not to worry; strong ref here
button.addTarget(sleeve, action: NSSelectorFromString("runContainedClosure"), for: .touchUpInside)
When it prints out what methods are available, runContainedClosure
is not there, just init
and dealloc
.
Can anybody help? I've been working on this for several days and been unable to get it to work. I see that @spierce7 successfully got something like it working at one point.spierce7
07/08/2019, 11:32 PMJVM: Benchmark Completed. Benchmark Total Millis: 17324, Average iteration was 346.42 millis
Native: Benchmark Completed. Benchmark Total Millis: 185398, Average iteration was 3707.94 millis
JoakimForslund
07/10/2019, 11:43 AMRostislav Utrobin
07/10/2019, 12:01 PMspierce7
07/10/2019, 7:20 PMIvan Ilic
07/12/2019, 1:14 PMsksk
07/13/2019, 4:27 PMnapperley
07/15/2019, 3:42 AMPaul Idstein
07/15/2019, 8:15 AMdealloc
in Kotlin? I will as a final step call super.dealloc to dispose KRefSharedHolder, but before that I would like to clean-up scoped pointersspierce7
07/15/2019, 8:15 PMarm64 arm64e armv7 armv7s
. Can kotlin/native do arm64e or armv7s?spierce7
07/15/2019, 8:31 PM<Kotlin Class>.Companion().<companion function>()
. Did we overlook something, or is this a known limitation?spierce7
07/15/2019, 8:38 PMthevery
07/16/2019, 8:36 AMnapperley
07/17/2019, 2:18 AMkpgalligan
07/17/2019, 3:12 PMm
07/17/2019, 6:33 PMsuspend
methods and doesn’t warn about that due compilation for iOS. So, is it possible to enable such warnings?napperley
07/17/2019, 10:48 PMmben
07/18/2019, 8:36 AMKruger Brent
07/18/2019, 4:15 PMtylerwilson
07/19/2019, 1:47 AMMichał Kalinowski
07/19/2019, 6:35 AMignus
07/19/2019, 6:41 AMirus
07/20/2019, 11:07 AM#include <jvmti.h>
#include <stdio.h>
JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM* vm, char* options, void* reserved) {
return 0;
}
// SIGSEGV
@CName("Agent_OnLoad")
fun Agent_OnLoad(
vm: CValuesRef<JavaVMVar>?,
options: CValuesRef<ByteVar>?,
reserved: CValuesRef<*>?
:disappointed: jint {
println("Agent: Hello, World!")
return 0
}
// ok
@CName("Agent_OnLoad")
fun Agent_OnLoad(
vm: NativePtr,
options: NativePtr,
reserved: NativePtr
:disappointed: jint {
println("Agent: Hello, World!")
return 0
}
irus
07/20/2019, 11:07 AM#include <jvmti.h>
#include <stdio.h>
JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM* vm, char* options, void* reserved) {
return 0;
}
// SIGSEGV
@CName("Agent_OnLoad")
fun Agent_OnLoad(
vm: CValuesRef<JavaVMVar>?,
options: CValuesRef<ByteVar>?,
reserved: CValuesRef<*>?
:disappointed: jint {
println("Agent: Hello, World!")
return 0
}
// ok
@CName("Agent_OnLoad")
fun Agent_OnLoad(
vm: NativePtr,
options: NativePtr,
reserved: NativePtr
:disappointed: jint {
println("Agent: Hello, World!")
return 0
}
napperley
07/21/2019, 12:00 AMirus
07/21/2019, 12:11 PMolonho
07/22/2019, 1:05 PMCPointer<JavaVMVar>
and such is right type here.irus
07/22/2019, 8:40 PMcinterop
generated CValuesRef<JavaVMVar>?
here. Headers from jdk11olonho
07/23/2019, 11:02 AMCPointer
is subclass of CValuesRef
, and in this case it shall be used. cinterop
is not related to the problem here, as it provides bindings to the C library from Kotlin, and in your case you produce C library from Kotlin source code.