ribesg
10/15/2020, 2:36 PMntherning
10/15/2020, 4:34 PMBor Monty
10/18/2020, 9:47 AMGieted
10/18/2020, 2:05 PMUgi
10/18/2020, 10:10 PMint sodium_unpad(size_t *unpadded_buflen_p, const unsigned char *buf,
size_t padded_buflen, size_t blocksize);
Which looks like this in kotlin:
@kotlinx.cinterop.internal.CCall public external fun sodium_unpad(unpadded_buflen_p: kotlinx.cinterop.CValuesRef<platform.posix.size_tVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, buf: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, padded_buflen: platform.posix.size_t /* = kotlin.ULong */, blocksize: platform.posix.size_t /* = kotlin.ULong */): <http://kotlin.Int|kotlin.Int> { /* compiled code */ }
As you can see the first parameter is a pointer to size_t
, I worked around this on 64 bit machines by doing this:
var newSize = ULongArray(1) { 0UL }
val newSizePinned = newSize.pin()
sodium_unpad(
newSizePinned.addressOf(0),
paddedDataCopyPinned.toPtr(),
paddedData.size.convert(),
blocksize.convert()
)
And it works fine on 64bit machines, unfortunately on 32bit machines it doesn't expect ULong, but UInt, and I get the following error:
LibsodiumUtil.kt: (66, 13): Type mismatch: inferred type is CPointer<ULongVarOf<ULong>> but CValuesRef<size_tVar /* = UIntVarOf<UInt> */>? was expected
Any clues on how to move forward?Gieted
10/19/2020, 7:47 AMGieted
10/19/2020, 8:46 AMIaroslav Postovalov
10/19/2020, 9:38 AMGieted
10/20/2020, 8:44 AM<http://java.io|java.io>.File#path
using Windows native apis. However, I'm not sure which arguments I should supply this function with and how to convert resulting DWORD
to Kotlin's String
Anders
10/20/2020, 2:23 PMautoreleasepool
on Darwin platforms. So any ObjC/Swift code that intentionally/unintentionally runs on Kotlin Native workers are going to leak autorelease references, especially when using with Kotlin Coroutines native-mt.
edit: This also seemingly impacts K/N garbage collection, because the wrapper around K/N object reference could be made autorelease references.
Should this be filed as a kotlinx-coroutine issue, or a Kotlin YouTrack one?Kris Wong
10/20/2020, 9:17 PMMerseyside
10/21/2020, 4:33 AMSachin Maharana
10/22/2020, 10:07 AMkotlinc-native Hello.kt -o hello
/usr/local/bin/kotlinc-native: line 20: /usr/local/bin/run_konan: No such file or directory
James Smith
10/22/2020, 12:31 PMdyld: Library not loaded: @rpath/iOSProject.framework/iOSProject
Here is cinterops:
// Path to .def file
defFile("src/iosMain/cinterop/iOSProject.def")
// Directories for header search (an analogue of the -I<path> compiler option)
includeDirs("$projectDir/native/iOSProject/iOSProject.framework/Headers")
Here is def:
language = Objective-C
headers = iOSProject.h iOSProject-Swift.h
staticLibraries = libiOSProject.a
libraryPaths = ../iOSProject.framework
Any idea why it happens? Maybe there are alternative ways to include the library?HankG
10/24/2020, 2:37 PMUncaught Kotlin exception: kotlin.IllegalStateException: Cannot execute task because event loop was shut down
with the CIO client explicitly selected when creating the HttpClient. It's code that works under the JVM though.natario1
10/24/2020, 4:29 PMStableRef.create(item).asCPointer().toLong()
, then it is passed outside of the K/N runtime, then it comes back on another thread and you fetch the item again with something like long.toCPointer<CPointed>()?.asStableRef<Item>()
?
Would you end up with the two `Item`s that point to the same location in memory, and that can be accessed concurrently from the two threads? So overcoming the current memory model. Or would this fail, and if so how?HankG
10/24/2020, 8:03 PMcommonMain
or nativeMain
block.HankG
10/25/2020, 2:17 PMChristian Sousa
10/26/2020, 10:43 AMUIWebView
that Apple announced: https://developer.apple.com/news/?id=12232019b
Running the following command on our binary
for framework in Frameworks/*.framework; do
fname=$(basename $framework .framework)
echo $fname
nm $framework/$fname | grep UIWebView
done
We get the following output:
0000000000990190 s __OBJC_LABEL_PROTOCOL_$_UIWebViewDelegate
00000000009e64a0 d __OBJC_PROTOCOL_$_UIWebViewDelegate
Which means that our SDK does have references to UIWebViewDelegate, but this is not in use and this is a potential roadblocker for every iOS app integrating the SDK.
Also, when trying to upload a sample app we get the warning about the usage of UIWebView
.
As far as I can understand, the interop lib includes these references for legacy reasons or something like that.
What would be our best solution for this issue? Or are there any plans on removing the UIWebView
from the KMP Lib?
Thanks a lot! 🙂darkmoon_uk
10/27/2020, 6:39 AMstruct -[ObjC-to-Kotlin]-> CValue<struct> -[Kotlin-to-ObjC]-> struct
☝️
🤔 Is this is gap in K/N interop? On iOS, I'm handling some Obj-C struct types in my business logic. These are represented in Kotlin-land as a CValue<MyStruct>
as per interop documentation.
Now I'm passing those values back to the UI layer, they comes back out of Kotlin code into Swift/Obj-C. At this point they are still seen as CValue<MyStruct>
with no apparent means, to retrieve/unwrap the original struct type from it... is this not possible?
The documentation is lacking when it comes to explaining how to bridge structs in this direction.Omar Mainegra
10/27/2020, 4:35 PM1.4.20-dev-3947
version, which works fine in many of ours projects, but in one of them I'm getting
e: java.lang.IncompatibleClassChangeError: Found interface org.jetbrains.kotlin.ir.declarations.IrModuleFragment, but class was expected
at org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationLoweringExtension.generate(SerializationLoweringExtension.kt:59)
at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$psiToIrPhase$1$1.invoke(ToplevelPhases.kt:203)
at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$psiToIrPhase$1$1.invoke(ToplevelPhases.kt)
at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:95)
at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$psiToIrPhase$1.invoke(ToplevelPhases.kt:240)
at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$psiToIrPhase$1.invoke(ToplevelPhases.kt)
at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$namedOpUnitPhase$1.invoke(PhaseBuilders.kt:97)
at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$namedOpUnitPhase$1.invoke(PhaseBuilders.kt:95)
at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:94)
at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:30)
It works just fine in 1.4.20-M2
and in jvm
and js
targetsKristian Tan
10/28/2020, 11:30 AMe: java.lang.RuntimeException: Cannot extract archive with dependency: /home/kristian/.konan/cache/target-gcc-toolchain-3-linux-x86-64.tar.gz.
I'm running the project on a Ubuntu machine, and when I check the directory in the error message I can see that the relevant .tar.gz file is present. Does anyone know what I can do to fix this?Animesh Sahu
10/28/2020, 1:32 PMplatform.posix.*
package?Animesh Sahu
10/28/2020, 1:33 PMaleksey.tomin
10/29/2020, 5:45 AMval ctx1 = newSingleThreadContext("run1")
launch(ctx1) {
run1()
}
val ctx2 = newSingleThreadContext("run2")
launch(ctx2) {
run2()
}
But I’ve found that different logics in different contexts can’t work in same time - when I turn off run2 feature - run1 works faster.
How can I run some code (with coroutines support) in another thread?
PS: run1 - ktor/curl client, run2 - file operations.
PPS: I’ll migrate to serialization 1.0.1 today but (I think) it doesn’t matter.Susheel
10/29/2020, 11:26 PMsaket
10/30/2020, 6:22 AMribesg
10/30/2020, 1:57 PMclass MyUITableViewDelegate : NSObject(), UITableViewDelegateProtocol {
companion object : NSObjectMeta(), UITableViewDelegateProtocolMeta
override fun tableView(tableView: UITableView, didSelectRowAtIndexPath: NSIndexPath) {
// Things
}
override fun tableView(tableView: UITableView, heightForRowAtNSIndexPath: NSIndexPath): CGFloat =
UITableViewAutomaticDimension
}
v79
10/30/2020, 5:24 PMlinuxArm32Hfp("pi") {
compilations.main {
cinterops {
libcurl
}
}
binaries {
executable {
entryPoint = "main"
}
}
}
v79
11/01/2020, 10:26 AM