this post was submitted on 23 Aug 2023
48 points (96.2% liked)

Programmer Humor

19564 readers
795 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 

Why do we need appimage when we can have single binary statically compiled executable?

Additionally, I can't really understand why are dynamically linked libraries so popular and how on earth anyone who ever had a ".dll / .so not found" error thinks this is a good idea.

The main idea as far as I understand was to be able to share code which I think everyone knows work only in theory, besides would it not be easier to just recompile the executable from source with updated dependency statically linked?

Other idea behind dlls were that you could replace a dll with different dll as long as the api was compatible which is very unlikely scenario for average people.

Yet another possible advantage would be that the library code is shared so it takes less space on disk which might be true for some libraries which are very common but on the other hand static compilation only includes the part of library code that is used by the program so it takes less space anyway and is more optimized.

So the reasons to use the dlls can be easily dismissed.

About the disadvantages - if the dll is not present the program will not work. It's quite simple and in my view if you create a program which does not work by itself then that's a failure on your side.

The dlls are just nightmare most of the time, static compilation for the win. (pic for attention)

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 3 points 1 year ago (1 children)

Did you,... hrm,... did you even take classes about this stuff. Ffs, this is why this career pays well: you have to understand complicated things.

Maybe your issue is with Windows. I suggest moving away from that platform.

Dynamic libraries are essential to computing, and allow us to partition out pieces of the code. One giant library would have to be recompiled with every change.

[โ€“] [email protected] 3 points 1 year ago

I mean yeah, dynamic libraries are great if used correctly (via something like Nix), but the unfortunate truth is, that they are not used correctly most of the time (the majority of the Unix and Windows landscape is just a mess with dynamic libraries).

With modern systems programming (Rust) the disadvantages of static compilation slowly fade away though via e.g. incremental compilation.

That said dynamic libraries are still a lot faster to link and can e.g. be hot-swapped.