alec
04/05/2022, 12:20 PMkotlinx-coroutines-core:x.x.x-native-mt
still a thing are or does that not need to exist with the new native memory modelGuy Tavor
04/06/2022, 1:43 PMnapperley
04/08/2022, 2:04 AMJoakim Forslund
04/08/2022, 6:15 AMint (*messageClass)(struct UIElement *element, UIMessage message, int di /* data integer */, void *dp /* data pointer */);
I also have this c function:
UIElement *UIElementCreate(size_t bytes, UIElement *parent, uint32_t flags,
int (*messageClass)(UIElement *, UIMessage, int, void *), const char *cClassName);
That in kotlin interop becomes:
fun UIElementCreate(
bytes: size_t,
parent: CValuesRef<UIElement>?,
flags: uint32_t,
messageClass: CPointer<CFunction<(CPointer<UIElement>?, UIMessage, Int, COpaquePointer?) -> Int>>?, cClassName: kotlin.String?): CPointer<UIElement>? { }
I then try to call above method from kotlin with:
UIElementCreate(sizeOf<UIWindow>().toULong(),null,UI_ELEMENT_WINDOW,staticCFunction(::messageCallback),"Window")
fun messageCallback(element: CPointer<UIElement>?, message: UIMessage, di: Int, dp: COpaquePointer?): Int {
println("Inside weird ass callback")
return 0
}
This results in a crash, What am I doing wrong? As a side-note I also ran the staticCFunction as inline, had the same result (and the function is called just fine from pure c)jcechace
04/12/2022, 2:11 PMJames Ward
04/15/2022, 10:25 AMMETA-INF
and then load it via classLoader.getResourceAsStream
but I'm not sure if there is a way to do something similar in native.4brunu
04/19/2022, 9:51 AMlistOf(
iosX64(),
iosArm64(),
//iosSimulatorArm64() sure all ios dependencies support this target
).forEach {
it.binaries.framework {
baseName = "shared"
isStatic = true
}
}
The problem is that when I make this change, I got 5000 warnings when building the iOS project.
Any idea why?
By the way, I'm not using cocoapods.
``````Ayfri
04/22/2022, 11:10 PMCPointer<WCHARVar>
?Charles Prado
04/26/2022, 6:50 PMCalling Kotlin suspend functions from Swift/Objective-C is currently supported only on main thread
I’m using KTOR 2.0.0 with the new memory model. Getting this error when trying to call an async func inside a Task from this iOS side. There’s currently something I can do to be able to call that function in that context?Dominaezzz
04/27/2022, 8:29 PMw: skipping D:\a\kgl\kgl\kgl-glfw\build\classes\kotlin\commonizer\cglfw\H3MydyJqF8c0JoJ3z3gndIlI7DE=\(linux_x64, macos_x64, mingw_x64)\com.kgl_kgl-glfw-cinterop-cglfw. The target doesn't match. Expected 'linux_x64', found [mingw_x64]
https://github.com/JetBrains/kotlin/blob/v1.6.21/kotlin-native/shared/src/library/[…]kotlin/org/jetbrains/kotlin/konan/library/SearchPathResolver.ktmartmists
04/30/2022, 4:13 PMnapperley
05/02/2022, 9:22 PMnapperley
05/03/2022, 1:05 AMmartmists
05/04/2022, 10:53 PMrrva
05/05/2022, 3:43 PMsuspend fun refreshToken(token: Token)
if the cache is cold, I want to prevent coroutines concurrently refreshing the value
I have tried some solutions
Semaphore (the coroutine aware one)
Actor-like impl with channels but without actor lib.
Are there any other simpler/more obvious solutions?napperley
05/06/2022, 3:46 AM./perf_snap.kexe sunny --useSsh remote_host
Creating SSH Console report...
-- sunny Resource Usage --
Short Process Name: sunny_island_te
Binary Path: /home/a_user/sunny_island_telemetry.kexe
Threads Used: 3
Total Reserved RAM (in KB): 24840
Binary Size (in bytes): 4149432
MJegorovas
05/06/2022, 1:45 PMObservableObject
and Published
in swiftUI.Vivek Modi
05/06/2022, 9:38 PMmartmists
05/06/2022, 10:58 PM#define
'd functions into actual functionsNikolay Kasyanov
05/12/2022, 12:01 PMAny?.identityHashCode()
in Native uses object’s memory address only, unlike JVM, where a piece of random data could be used, making identityHashCode
unique even if two objects happen to be allocated at the same memory address during app’s lifetime.
Would it make sense to file this as a bug (it’s a noticeable discrepancy with JVM, after all) or is it a conscious decision to have this implementation in Native?hfhbd
05/12/2022, 3:27 PMSimon BRUNOU
05/13/2022, 2:19 PMplatform.windows.*
or platform.posix.*
.
#include <Winsock2.h>
#include <Ws2bth.h>
#include <BluetoothAPIs.h>
Those are standard Win32 headers but I can’t find them anywhere on Kotlin/Native.
I am developing on macOS 12.4 with an M1 processor, if it matters.
Do I need to use cinterop and bind them manually? Or am I looking in the wrong place?
Thanks in advance!martmists
05/14/2022, 10:19 AMe: org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering
File being compiled: /home/mart/git/kaudio-python/src/nativeMain/kotlin/kaudio/nodes/util/InputNode.kt
The root cause java.lang.IllegalArgumentException was thrown at: org.jetbrains.kotlin.backend.konan.lower.InteropTransformer.visitCall(InteropLowering.kt:1117)
at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException(CodegenUtil.kt:238)
at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException$default(CodegenUtil.kt:234)
at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invokeSequential(performByIrFile.kt:68)
Ji Sungbin
05/14/2022, 10:21 AMmartmists
05/14/2022, 10:26 PM'void com.jetbrains.cidr.execution.debugger.CidrDebuggerSettings.setLLDBNatvisRenderersEnabled(boolean)'
Sam Stone
05/15/2022, 4:00 PMAlexander Black
05/16/2022, 7:33 PMINSERT OR REPLACE INTO (id, ...) VALUES(?, ...)
operation? So if I had a null id passed in for the primary key… it makes sense, but I’m not passing in a null. Any advice would be helpful.Karel Petránek
05/19/2022, 11:36 PMAVCaptureVideoDataOutputSampleBufferDelegateProtocol
in Kotlin on iOS and the delegate method never gets called (equivalent code in Swift/ObjC works fine). I suspect it’s because of the protocol definition in Kotlin:
@kotlinx.cinterop.ExternalObjCClass public interface AVCaptureVideoDataOutputSampleBufferDelegateProtocol : platform.darwin.NSObjectProtocol {
@kotlinx.cinterop.ObjCMethod public open fun captureOutput(output: platform.AVFoundation.AVCaptureOutput, didOutputSampleBuffer: platform.CoreMedia.CMSampleBufferRef? /* = kotlinx.cinterop.CPointer<cnames.structs.opaqueCMSampleBuffer>? */, fromConnection: platform.AVFoundation.AVCaptureConnection): kotlin.Unit { /* compiled code */ }
@kotlinx.cinterop.ObjCMethod public open fun captureOutput(output: platform.AVFoundation.AVCaptureOutput, didDropSampleBuffer: platform.CoreMedia.CMSampleBufferRef? /* = kotlinx.cinterop.CPointer<cnames.structs.opaqueCMSampleBuffer>? */, fromConnection: platform.AVFoundation.AVCaptureConnection): kotlin.Unit { /* compiled code */ }
}
Note that both captureOutput
methods have the exact same signature, they only differ in parameter names. It is impossible to override both methods in Kotlin (it’s also impossible to define such interface in Kotlin code) so I suspect some trickery there. Has anyone met this issue before? Is there a workaround to make Kotlin properly override these ObjC methods?Julian Hille
05/20/2022, 8:52 AMConrad Kramer
05/23/2022, 8:45 PMKotlin_ObjCExport_trapOnUndeclaredException
and the “Application Specific Information” which normally contains the exception message (for Swift traps and Objective-C exceptions) just shows abort() called
Is there a way to put the Kotlin exception message inside of the crash report?Conrad Kramer
05/23/2022, 8:45 PMKotlin_ObjCExport_trapOnUndeclaredException
and the “Application Specific Information” which normally contains the exception message (for Swift traps and Objective-C exceptions) just shows abort() called
Is there a way to put the Kotlin exception message inside of the crash report?ankushg
05/23/2022, 8:53 PMRick Clephas
05/23/2022, 8:54 PMConrad Kramer
05/23/2022, 8:55 PMsetUnhandledExceptionHook
(which is what they use), so perhaps I could take the exception and crash myself in a way that reports the exception message correctly
I do wonder how “Application Specific Information” is populated, though, and if there is a way to get this functionality into Kotlin itselfRick Clephas
05/23/2022, 9:00 PMNSError
and then send it to ObjC/Swift. From there you could basically throw it or something to get the "normal behavior".
Not sure if that would actually work but might be worth to try.Conrad Kramer
05/23/2022, 9:01 PM__crash_info
)ankushg
05/23/2022, 9:21 PMRick Clephas
05/23/2022, 9:22 PMkpgalligan
05/23/2022, 9:26 PMConrad Kramer
05/25/2022, 7:42 AMkpgalligan
05/25/2022, 12:00 PM__crash_info
structure (https://github.com/firebase/firebase-ios-sdk/blob/35669875acdb8d27503feead0d8a2b3d3a0fe19c/Crashlytics/Crashlytics/Components/FIRCLSProcess.c#L752), but it seems to only care about the message
field (https://github.com/firebase/firebase-ios-sdk/blob/35669875acdb8d27503feead0d8a2b3d3a0fe19c/Crashlytics/Crashlytics/Components/FIRCLSProcess.c#L804). I was getting excited that maybe the backtrace
field (https://github.com/firebase/firebase-ios-sdk/blob/35669875acdb8d27503feead0d8a2b3d3a0fe19c/Crashlytics/Crashlytics/Components/FIRCLSProcess.c#L756) would be the magic key, but as far as I can see, at least Crashlytics doesn’t care about it.__crash_info
, I think the piece, or one of the pieces, that I’m missing is what actually gets put in there, and who is intended to read it? I did go through the wireshark and firefox code, but only lightly. I’m definitely not set up for local native dev like that, so I’ve just been reading source. I think writing to it would be easy enough if I understand what’s happening, although I wouldn’t know what to write. Also, I have that background concern of if this is actually a private api, does that mess with app store submissions? That last one is a bit down the road as far as worries go, but still.Rick Clephas
05/25/2022, 2:42 PMAlso, I have that background concern of if this is actually a private api, does that mess with app store submissions?As long as Swift is using the same that shouldn’t be an issue, right? Also if Crashlytics is aware of it then it’s already part of your app.
kpgalligan
05/25/2022, 3:23 PM__crash_info
is a problem, but I’m not sure that it’s considered private either. Poorly documented for sure, but not sure it’s something Apple cares about. but, again, I’m also not sure it’ll do much for the crash reports, at least for stack traces.Rick Clephas
05/25/2022, 3:52 PMBugsnag at least lets you inspect and modify crash reports before they’re sent to the server … and I’m not sure Crashlytics or others allow the same.Yes if automatic collection is disabled you can update the report before it’s send: https://firebase.google.com/docs/reference/swift/firebasecrashlytics/api/reference/Classes/Crashlytics#checkandupdateunsentreports Though there is no field for a stacktrace, but you could add it as logs or as a custom value or something.
Conrad Kramer
05/25/2022, 4:09 PMkpgalligan
05/25/2022, 5:12 PMwhen I was reading reports at AppleApologies in advance for the endless list of questions I might throw at you in the future
As for reporting, I am always just going to use Apple’s crash reporting functionalityWe’re primarily focused on 3rd party tools, but that’s mostly because that’s what our clients are using. Certainly interested to see what you figure out.
The backtrace functionality does work – NSException actually uses it. I remember reading a lot of “Application Specific Backtrace” sectionsI’d definitely love to see how this works. The apple-side internals are a bit out of my wheelhouse, and I’m not sure the 3rd party tools wouldn’t report this, but would need to try it and see how it goes.
I’ll likely write a diff for the Kotlin runtime to use crash_info (as that is where it belongs, in the runtime), but compiling Kotlin sounds like a PITAI wouldn’t say compiling Kotlin is the easiest, but it’s not too bad once you get it set up. We’re hacking around compiler changes now. If you have thoughts on what that should look like we might be able to try some things our, or just assist getting local dev working for you if needed.
Conrad Kramer
05/26/2022, 6:16 PM__crash___info
section, but the crash info section seemingly only gets checked for system libraries. I updated the code to find an existing section in a system library and write to thatkpgalligan
05/26/2022, 6:19 PMConrad Kramer
05/26/2022, 6:22 PMkpgalligan
05/26/2022, 6:29 PM