jk2018
01/08/2020, 1:36 AMplatform.windows.UuidCreate(...)
This shows up in auto-complete. And IntelliJ doesn't complain. But the compiler ends up crashing. Also, auto-complete finds some functions which do work, like :
val tempPath = GetTempPath?.invoke(nBufferLength, buffer)
.. I'm a bit lost as to what I can expect to work? What's a good place to find a correct definition of what works?Prateek Grover
01/08/2020, 10:04 AMBig Chungus
01/08/2020, 1:17 PMlinkerOpts
either in gradle config or *.def
file to be output of
pkg-config --libs <LIB>
?ribesg
01/08/2020, 1:55 PMval
in companion object
having incorrect value on iOS, anyone saw anything about that? For example I have this in a subclass of UICollectionViewCell
(hence the object superclass):
companion object : UICollectionViewCellMeta() {
const val HEIGHT = 100.0
}
But when I print the value of HEIGHT
anywhere it has a nonsense value, maybe returning a pointer or reading random memory, it returns something like 6e-310. It also does not return the same value every time its read from different instances of the subclass of UICollectionViewCell
. Wtf?
Note: Removing const
doesn’t change anything. No problem if the val
is global, local to the class or a getter (val HEIGHT: Double get() = 100.0
)Big Chungus
01/08/2020, 2:37 PMgonzooin
01/08/2020, 2:44 PMinit {
uiView.searchTextField.addTarget(this, platform.darwin.sel_registerName("searchTextChanged"), UIControlEventEditingChanged)
}
@ObjCAction
private fun searchTextChanged() {
// some code
}
iOS Crash
2020-01-08 15:34:46.891004+0100 Production[69085:8719071] -[kobjcc0 searchTextChanged]: unrecognized selector sent to instance 0x6000036b1620
2020-01-08 15:34:46.897007+0100 Production[69085:8719071] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[kobjcc0 searchTextChanged]: unrecognized selector sent to instance 0x6000036b1620'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23c91fd4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff23c75c4c ___forwarding___ + 1436
4 CoreFoundation 0x00007fff23c77f78 _CF_forwarding_prep_0 + 120
5 UIKitCore 0x00007fff48093fff -[UIApplication sendAction:to:from:forEvent:] + 83
6 UIKitCore 0x00007fff47a6c00e -[UIControl sendAction:to:forEvent:] + 223
7 UIKitCore 0x00007fff47a6c358 -[UIControl _sendActionsForEvents:withEvent:] + 398
8 UIKitCore 0x00007fff4839655f -[UITextField fieldEditorDidChange:] + 202
9 UIKitCore 0x00007fff4837b53a -[UIFieldEditor textInputDidChange:] + 61
10 UIKitCore 0x00007fff483a6d45 -[UITextInputController _sendDelegateChangeNotificationsForText:selection:] + 104
11 UIKitCore 0x00007fff483a9628 -[UITextInputController _insertText:fromKeyboard:] + 765
12 UIKitCore 0x00007fff483aa07f -[UITextInputController insertText:] + 336
13 UIKitCore 0x00007fff4837ec97 -[UIFieldEditor insertFilteredText:] + 838
14 UIKitCore 0x00007fff4839c5e3 -[UITextField insertFilteredText:] + 93
15 UIKitCore 0x00007fff47ea906b -[UIKeyboardImpl insertText:] + 147
16 UIKitCore 0x00007fff47ea3863 -[UIKeyboardImpl _performKeyboardOutput:shouldCheckDelegate:] + 1059
17 UIKitCore 0x00007fff47ea24bd __55-[UIKeyboardImpl handleKeyboardInput:executionContext:]_block_invoke_2 + 372
18 UIKitCore 0x00007fff47ed1ab1 -[UIKeyboardTaskEntry execute:] + 147
19 UIKitCore 0x00007fff47ed05c7 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 310
20 Foundation 0x00007fff25781c30 __NSThreadPerformPerform + 259
21 CoreFoundation 0x00007fff23bd4471 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
22 CoreFoundation 0x00007fff23bd439c __CFRunLoopDoSource0 + 76
23 CoreFoundation 0x00007fff23bd3b74 __CFRunLoopDoSources0 + 180
24 CoreFoundation 0x00007fff23bce87f __CFRunLoopRun + 1263
25 CoreFoundation 0x00007fff23bce066 CFRunLoopRunSpecific + 438
26 GraphicsServices 0x00007fff384c0bb0 GSEventRunModal + 65
27 UIKitCore 0x00007fff48092d4d UIApplicationMain + 1621
28 Production 0x000000010c1b1359 platform_UIKit_UIApplicationMain_wrapper64 + 89
29 Production 0x000000010c10a7cb kfun:main(kotlin.Array<kotlin.String>) + 1371
30 Production 0x000000010c10ab1c Konan_start + 156
31 Production 0x000000010c17249f Init_and_run_start + 111
32 libdyld.dylib 0x00007fff5227ec25 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
my code is inspired from KotlinFinder project ( https://github.com/JetBrains/KotlinFinder/blob/master/ios-app/src/iosMain/kotlin/Views/CollectWordView.kt )
Slack ConversationBig Chungus
01/08/2020, 5:19 PMld.lld: error: unable to find library -lglib-2.0
when linking for linux. -lglib-2.0
is one of the linkerOpts. Any suggestions on what's wrong?Big Chungus
01/08/2020, 8:47 PMWe use the staticCFunction{..} helper function from Kotlin/Native to wrap a Kotlin lambda function into a C function pointer. It only allows having unbound and non-capturing lambda functions.
Could someone elaborate on what it means by unbound and non-capturing lambda functions
. Does it mean that for instance if you want to register callbacks from c they cannot be in a kotlin class, but rather only top-level function?napperley
01/08/2020, 9:31 PMLei Wu
01/09/2020, 8:30 AMobject LogUtil {
fun log(message: String) {
}
}
but export to ios framework, the class defined like this:
*__attribute__*((objc_subclassing_restricted))
*__attribute__*((swift_name("LogUtil")))
*@interface* CommonLogUtil : KotlinBase
+ (*instancetype*)alloc *__attribute__*((unavailable));
+ (*instancetype*)allocWithZone:(*struct* _NSZone *)zone *__attribute__*((unavailable));
+ (*instancetype*)logUtil *__attribute__*((swift_name("init()")));
- (*void*)logMessage:(NSString *)message *__attribute__*((swift_name("log(message:)")));
*@end*;
As code shows that “logMessage” method is not a “class method”,
the expected result maybe like this:
+ (*void*)logMessage:(NSString *)message *__attribute__*((swift_name("log(message:)")));
Kavan
01/09/2020, 4:18 PMdispatch("Hello") {
println("Printing $it from Thread Started \n")
}
and not with this ?
dispatch("Hello") {
println(it)
println("Printing from Thread Started \n")
}
Code:
fun <P, T> dispatch(param: P, block: (P) -> T) {
val ref = StableRef.create(param to block)
pthread_create(nativeHeap.alloc<pthread_tVar>().ptr, null, staticCFunction { data: COpaquePointer? ->
data?.asStableRef<Pair<P, (P) -> T>>()?.get()?.let { it.second.invoke(it.first.freeze()) }
NULL
}.reinterpret(), ref.asCPointer())
ref.dispose()
}
Big Chungus
01/09/2020, 4:34 PMException in thread "main" org.jetbrains.kotlin.konan.KonanExternalToolFailure: The /home/mpetuska/.konan/dependencies/clang-llvm-8.0.0-linux-x86-64/bin/clang command returned non-zero exit code: 1.
output: clang-8: error: no such file or directory: '
'
I'm on manjaro linuxjdiaz
01/10/2020, 2:49 PMjmillner_
01/10/2020, 3:10 PMlibcurl.*
import? Even though I have the libcurl.def in the correct nativeInterop sub folder under src
?Patrick
01/10/2020, 3:22 PMKris Wong
01/10/2020, 6:45 PMKavan
01/11/2020, 1:00 PMftomassetti
01/12/2020, 8:41 AMBig Chungus
01/12/2020, 11:13 AMprivate val dispatcher= Executors.newSingleThreadExecutor().asCoroutineDispatcher()
on native?Big Chungus
01/12/2020, 3:52 PMkotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen
for any top-level object I declare?jk2018
01/12/2020, 7:24 PMkotlinx.cinterop.staticCFunction
" when called as a callback from C . (Thread/SO link)StefMa
01/13/2020, 7:06 AMKavan
01/13/2020, 9:20 AMMateusz Konieczny
01/13/2020, 9:39 AMBig Chungus
01/13/2020, 10:21 AMandreasmattsson
01/13/2020, 10:23 AMvsnprintf
Thomas
01/13/2020, 10:43 AMKris Wong
01/13/2020, 4:44 PMKris Wong
01/13/2020, 5:05 PMHolger Steinhauer [Mod]
01/13/2020, 8:23 PM./gradlew build
produces a weired error (see stacktrace)