I'm trying to compile some code and it works, but I found I have to copy the dll to the working dir and I was just wondering why cmake or vs build doesn't just have a "fat binary" build... would make life easy. Not complaining, just wondering.
Just.. Wow. The ignorance of people is shocking. Some guy even said that it's not possible because a DLL can contain an entry point which is called when the DLL is loaded and a static library has no such thing... well nothing prevents me from manually calling such entry point from my main function. At the end it's all executable code, and it's absolutely possible to relocate some addresses and repackage the code as a static library. It's just that no one with the knowledge had a need to do it.
There are valid reasons for dlls however. The main one being symbol name collision.
For example, you can use a dll that links to version 1 of a library, while using version 2 of the library yourself without having any name collisions.
Many years ago when I did Linux development this was a main gripe of using .so files - imported names could clash with the same global names in your program and you get random runtime behaviour.