Live data from Hacker News

Announcing Rust 1.16

blog.rust-lang.org

31–40 of 95 posts

Re: Announcing Rust 1.16

#33
post #13

I might be a minority here, but can someone please update me on there state of Rust on iOS? I develop C++ cross platform iOS/Android apps and would love to use Rust if possible. The last time I checked Rust didn't support .frameworks creation, didn't support Bitcode and calling the main thread from Rust wasn't easy. I would love to hear if these issues have been resolved.

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?

> 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

#37

Earlier quoted context omitted.

You can't use dynamic libraries on iOS because they fail iTunes Connect validation. The only dylibs it allows are the Swift standard library. You can, however, use clang to take a static library and throw it into anything you want (framework, dylib, executable).

That's not true at all. You can use dynamic libraries; Swift modules produce .framework packages, which are dynamically linked.

I meant dylib files. You can't ship those, but you can ship dynamically linked frameworks.

Re: Announcing Rust 1.16

#38

Earlier quoted context omitted.

You can't use dynamic libraries on iOS because they fail iTunes Connect validation. The only dylibs it allows are the Swift standard library. You can, however, use clang to take a static library and throw it into anything you want (framework, dylib, executable).

It looks like you're right, Apple says you can't bundle dylibs outside of a Framework on iOS :\ What would be the difference though, why make the distinction? > Dynamic libraries outside of a framework bundle, which typically have the file extension .dylib, are not supported on iOS, watchOS, or tvOS, except for the system Swift libraries provided by Xcode. https://developer.apple.com/library/content/technotes/tn2435.…

From my understanding, the limitation is purely because of how Apple designed iTunes Connect validation, and not for technical reasons.

Re: Announcing Rust 1.16

#39
post #13

Earlier quoted context omitted.

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?

> 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, sen…

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

#40

Earlier quoted context omitted.

> The last time I checked Rust didn't support .frameworks creation From a purely "how do I get something I can link to" perspective, you can still build a cdylib and a header for it, Xcode will let you include the header in your Objective-C code or in the Swift bridging header, and then you can link to the cdylib and copy it into the "Frameworks" subdirectory in the bundle at build time. I've been doing that in an OS…

You can't use dynamic libraries on iOS because they fail iTunes Connect validation. The only dylibs it allows are the Swift standard library. You can, however, use clang to take a static library and throw it into anything you want (framework, dylib, executable).

If you can avoid using a dylib on iOS, I would do it. It effects startup performance time. Just make a static version and compile it into the binary?
Post reply on HN