Comment by mike_hearn

Comment by mike_hearn 9 days ago

3 replies

You can yes although the docs don't make that obvious.

https://www.blog.akhil.cc/static-jni

You can also use the FFI to avoid JNI.

I tend to feel that static linking is overrated. The moment you want easy upgrades of your app you need extra infrastructure anyway, and every tool for distributing such programs can handle directories as well as files.

neonsunset 9 days ago

> I tend to feel that static linking is overrated.

I agree. My response was just meant to indicate that NativeAOT has comparatively more effort and focus in .NET ecosystem than GraalVM's Native Image in JVM's, and as a result is an option that is easier to opt into where it makes sense. There's an intention to make it play as nicely as possible with most common scenarios and ideally not require user input when enabling it even with difficult to analyze reflection scenarios.

mwcampbell 8 days ago

> I tend to feel that static linking is overrated.

For me, the big win of static linking is startup time. Just mmap the executable and go. No need to slow down the startup process with the very branchy process of resolving and loading DLLs.

  • mike_hearn 8 days ago

    That's true, although pre-linking means the bad old days of apps spending most of their time in the dynamic linker during startup are mostly behind us even when a program uses a reasonable number of libraries.