News for hackers. Stuff that matters.
Re:How to Use the Foreign Function API in Java 22 to Call C ... by fire_lake on Wednesday May 08, 2024 @02:13PM (#40301261)
Is there a solution when the binaries are 500mb+ per platform?
Re:How to Use the Foreign Function API in Java 22 to Call C ... by pjmlp on Wednesday May 08, 2024 @05:56PM (#40303097)
People seem pretty happy when Go and Rust do the same with static linking, advocating how great it happens to be.
Re:How to Use the Foreign Function API in Java 22 to Call C ... by yw3410 on Wednesday May 08, 2024 @07:40PM (#40303831)
You can't be as aggressive at removing functions in Java than in Rust though since it's dynamic dispatch (e.g., if you use toString once in your code, you need to keep all implementations of toString which are reachable even if users don't use reflection).
Re:How to Use the Foreign Function API in Java 22 to Call C ... by neonsunset on Thursday May 09, 2024 @05:05AM (#40306446)
.NET's trimmer/linker deals with this quite well, only referenced or otherwise observable .ToString() implementations are rooted.

Without it 1.6-2MiB-sized AOT binaries would not have been possible (most space is occupied by standard library/runtime bits and GC)

Re:How to Use the Foreign Function API in Java 22 to Call C ... by pjmlp on Thursday May 09, 2024 @07:20AM (#40307025)
Except that is what jlinker, and GraalVM/OpenJ9 (among other AOT toolchains) do in practice.
Re:How to Use the Foreign Function API in Java 22 to Call C ... by cesarb on Wednesday May 08, 2024 @07:02PM (#40303578)
Static linking in Go and Rust includes compiled code only for the target platform. It does not include compiled code for every possible architecture, including 32-bit MacOS and Solaris on PowerPC.
Re:How to Use the Foreign Function API in Java 22 to Call C ... by SJC_Hacker on Wednesday May 08, 2024 @08:34PM (#40304110)
Solaris... now thats a name I have not heard in a long time. A long time.
Re:How to Use the Foreign Function API in Java 22 to Call C ... by pjmlp on Thursday May 09, 2024 @07:22AM (#40307040)
Hence why you end up with 300MB x platforms, and tricks like upx.
Re:How to Use the Foreign Function API in Java 22 to Call C ... by fire_lake on Thursday May 09, 2024 @01:43AM (#40305601)
In Java libraries are shared precompiled so the package manager either needs to be platform aware or distribute fat bundles.
Re:How to Use the Foreign Function API in Java 22 to Call C ... by pjmlp on Thursday May 09, 2024 @07:21AM (#40307030)
Only for those that are yet to learn how to use jlinker.
Re:How to Use the Foreign Function API in Java 22 to Call C ... by mike_hearn on Thursday May 09, 2024 @03:49AM (#40306174)
Libraries like JCEF have support tools to download the libraries either at runtime or during the build, to offload from Maven Central.