a

    Andrey Makovskiy

    3 years ago
    Error message when compiling iOS framework: Unresolved reference: atomicfu. Jvm library compiles and works. Can anybody help?
    kpgalligan

    kpgalligan

    3 years ago
    I assume you’ll need to add the library dependency. I’m also not sure the atomics will do what you expect in native
    a

    Andrey Makovskiy

    3 years ago
    I tried but from iosMain it is not visible too
    kpgalligan

    kpgalligan

    3 years ago
    id ‘kotlinx-atomicfu’ is not native capable. You need to add atomic-fu directly as a dependency. That’s what the screenshot I shared is saying. Also, although this “compiles”, it doesn’t actually do anything atomically, if you’re hoping to interact with data from multiple threads: https://github.com/Kotlin/kotlinx.atomicfu/blob/master/atomicfu/src/nativeMain/kotlin/kotlinx/atomicfu/AtomicFU.kt
    To take a step back, I guess, what are you trying to do?
    a

    Andrey Makovskiy

    3 years ago
    I need synchronization and AtomicReference
    in common code
    synchronized is deprecated for common 😞
    there is no volatile for common
    kpgalligan

    kpgalligan

    3 years ago
    The sample app is old, but I wrote this: https://github.com/touchlab/Stately
    I feel like you should also understand how native threads work better, but I may be assuming things about your experience level with native.
    a

    Andrey Makovskiy

    3 years ago
    I developing multiplatform kotlin library for Android and iOS
    This library also requires threading inside
    kpgalligan

    kpgalligan

    3 years ago
    Have you done any threading with native?
    It’s not just atomics and synchronization. State is very different
    I also have some blog posts
    The 3rd one, explaining how all that works in Multiplatform, is pending a new version of Stately (which I’m currently working on)
    a

    Andrey Makovskiy

    3 years ago
    OK, thanks. I see that is it available in kotlin/native so I can implement it using expected/actual classes