News for hackers. Stuff that matters.
Re:Announcing Rust 1.16 by pjmlp on Thursday March 16, 2017 @02:35PM (#13887643)
Sorry for stealing the thread, on my case is Android/UWP.

Do you have any better approach to JNI calls other than Djinni, SafeJNI, SWIG, RPC-like with bulk of work on Java side?

Re:Announcing Rust 1.16 by jventura on Thursday March 16, 2017 @04:03PM (#13888649)
> Do you have any better approach to JNI calls other than Djinni, SafeJNI, SWIG, RPC-like with bulk of work on Java side?

I use this homegrown solution on an Android app of mine which integrates with the CPython interpreter: https://github.com/joaoventura/pybridge/

It is RPC-like, but the code is quite simple: https://github.com/joaoventura/pybridge/#how-it-works. In the java-side, you just create a JSON object, send it to Python-land and get the result. Here's the java example in the code (https://goo.gl/sw4JLt) and here's the python function that it calls (https://goo.gl/hgbqVR).

Don't know if it's what you're looking for, or how it compares to the solutions you mentioned above, but I had someone from dropbox contributing a fix, and mentioning that going forward with a solution like this he would need something similar to djinni regarding error handling: https://github.com/joaoventura/pybridge/pull/3#issuecomment-...

Re:Announcing Rust 1.16 by pjmlp on Thursday March 16, 2017 @04:27PM (#13888862)
Obrigado! :)

On my specific case it is more weekend programming, mainly focused on graphics and multimedia, so I can bare the ocasional pain for reading image files, being called as a service or interacting with the network related hardware.

Just wanted to have some heads up on other possibilities that I could be missing, from people that do it professionally.

Re:Announcing Rust 1.16 by FlyingSnake on Thursday March 16, 2017 @02:54PM (#13887905)
Have you tried Loopers for Android to update main thread from NDK BG thread? I've seen people have success with that, but I personally didn't try it. AFAIK if you want to use MVVM pattern, there's no option than to use JNI.

We use Djinni extensively and it does what it advertises. We've to be careful with retain cycles and Djinni proxies create strong retain cycles if didn't configure correctly.

I'm actively looking into libdispatch for threading. I've heard of people having success with long polling of file/socket and dispatch_source to update main threads from BG on iOS/Android. I'll probably write a blog post if I succeed (and that's a big IF).

Re:Announcing Rust 1.16 by pjmlp on Thursday March 16, 2017 @03:07PM (#13888057)
> Have you tried Loopers for Android to update main thread from NDK BG thread?

Not really, but I am aware of that pattern as it is the approach taken by SDL.

Thanks.