Few cents about my commits

AltPods: pods updated - 1.18.0-SNAPSHOT


ios12: class_copyProtocolList crash


Issue was reported on gitter and caused crash inside ObjC library of RoboVM with following stacktrace:

0 _mapStrHash(_NXMapTable*, void const*) + 4
1 _NXMapMember(_NXMapTable*, void const*, void**) + 52
2 NXMapGet + 20
3 getProtocol(char const*) + 28
4 class_copyProtocolList + 328
5 [J]org.robovm.objc.ObjCRuntime.class_copyProtocolList(JJ)J + 4358277632

Issue was reproduced on iOS12 simulator. Sample was simplified to following RoboVM/Java snippet:

Native Apple Silicon M1 support


Apple Silicon proposed in PR586. It includes:

  • m1 arm64 version of llvm, ilibmobiledevice, hfsconmpressor libraries to allow it being used with arm64 version of java;
  • support for arm64 iOS simulator and arm64 MacOSX console target.

How fast it is (compiling classes using 8 threads):

(Mac Mini m1): Compiled 3317 classes in 36.45 seconds
(Mac Pro W3565): Compiled 3317 classes in 111.60 seconds
(MacBook Pro, i5-4278U @ 4 threads): Compiled 3317 classes in 219.09 seconds

How to use

RoboVM 2.3.13 release and 2.3.14-SNAPSHOT


Available at Idea Marketplace (for AndroidStudio as well), also IDE plugins are available for download.

2.3.13: What’s new

Fixes and maintenance release:

  • fixed: NumberFormatException when compiling 1.4/1.5 kotlin code for Debugger PR581
  • changed: the way how dynamic libraries appears at linker command line PR580
  • fixed #561: reverted binding of structs with flexible array members PR565
  • fixed: GlobalValueEnumeration crash #567 PR571
  • reworked way swift dependencies are picked up PR552
  • Idea plugin maintenance: support for 2021.1 EAP PR570
  • fix for #557. merged several CryptoLib/OpenSSL fixes PR564
  • fix for: ClassCastException - passing java Interface implementation as ObjC protocol PR563
  • hot fix for CompilerException while compiling UIKey.keyCode PR553
  • CocoaTouch 14.3 and fixes PR551
  • fixed: @ByVal is not working for GlobalValues/Struct getters PR550
  • fixed #542: Dagger with Kotlin, IDE IPA Creation Problem PR549


Includes functionality currently in testing:

Happy coding!
Please report any issue to tracker.

Kotlin coroutines: Dispatchers.Main context for RoboVM applications


Android has kotlinx-coroutines-android Dispatcher.Main that coroutine execution on main/ui thread.
It allows writing an effective suspend logic on main thread as described on the usage page:

fun setup(hello: Text, fab: Circle) {
    GlobalScope.launch(Dispatchers.Main) { // launch coroutine in the main thread
        for (i in 10 downTo 1) { // countdown from 10 to 1 
            hello.text = "Countdown $i ..." // update text
            delay(500) // wait half a second
        hello.text = "Done!"


To make Dispatchers.Main available to kotlinx following steps to be done:

AltPods: pods updated - 1.16.0-SNAPSHOT


AltPods were updated to v1.16.0-SNAPSHOT to sync with recent releases.

New pods

Updated pods

These pods were pushed to https://oss.sonatype.org/content/repositories/snapshots maven repo under 1.16.0-SNAPSHOTS version. Source code @github

Updates are not fully tested, please open issue if bug found.

Alt-pods binding -- useful script


Alt-pods binding process includes time-consuming preparation activities like download binaries/copy/update versions etc. An attempt to automate these was made and messy scripts/dumpdeps.kts was born.
It automates following flow:

  • gives instruction where to download framework to;
  • deletes header files in bro/ folder and copies new;
  • deletes java/ folder with existing bindings;
  • invokes bro-gen script to perform binding;
  • tries to fetch version information from where possible;
  • updates version information in pom.xml/readme files;
  • can process multiple frameworks in multi-thread mode;

Also its kotlin-script, and it can be debugged in Idea.


Idea plugin: support for 2020.1 EAP


Simple update that makes it working in Idea 2020.1 EAP. Deprecated API where removed and plugin has to be updated.
Also JetBrains has fixed the issue that was making development using Maven model complicated (hooray!).
(Maven model is nice as allows to have code hot-swap)

Changes proposed as PR670

fix #567: GlobalValueEnumeration crash


fix #561: wrong pointer to flexible array member



issue #561 ExtAudioFile.read() isn’t playing nice anymore. @yajirobe69 in comment described that possible root case it is a due field annotation was changed from @Array({1}) to @ByVal.
buffers field is a flexible array member of AudioBuffer struts. To work with this array required to get pointer to first struct (member itself) and then navigate in it by using methods of Struct class.

Root case

Root case of issue was introduced in e0b6db6. Accessing struct member is a struct kind and is annotated as @ByVal will cause following:

  • first element being accessed;
  • copied;
  • copy of it is returned

While it is normal to read struct by value, in flexible array member case it is wrong as:

  • pointer to first struct is required, not pointer to the COPY;
  • future operations with copy, e.g. setting elements (at index 1+) might cause memory corruption.

The fix