ramsey84c: So it's a file from GOG (not the game publisher) that links my game to the galaxy client. If I delete it then the game breaks. Sounds like DRM or a way to track they game they sold you...
Part 1 of 2:
I can see how one could misunderstand how this aspect of software development works as it's really only something that one learns becoming a software developer and gaining experience using dynamic shared libraries.
It is not a form of DRM but let me try to explain.
Software is a combination of code written by the developer/company that is creating the program/app/game/whatever, as well as potentially including software created by 3rd parties. As an example, many software programs use the open source Freetype font rasterization library because it is a lot more efficient and convenient to use a pre-existing available library that provides this functionality than to rewrite it from scratch on a program by program basis. Developers create libraries of code to perform a given function that can be shared between many programs as a way of reusing code in an efficient manner. The primary way this is implemented is as a shared library, which in Windows is known as a DLL file (dynamic link library).
Another example of this would be Google CEF (Chromium Embedded Framework), which is the core web browser functionality of Google Chrome, the engine if you will - isolated into a library that other programs can use to integrate web browser like functionality into their software. It is distributed as a DLL file as well - libcef.dll and you'll find that library is distributed with every program that includes its functionality, which includes many programs people use every day such as various gaming clients, Discord, and many other programs such as OBS Studio.
If we look at OBS Studio as an example here, the Google libCEF.dll library is used to implement the Browser Source feature in OBS studio as well as the docked browser panels feature. Since the OBS program has these features available built into it which use the libCEF library, that library absolutely must be installed on the system in order for the program to function even if the person is not actually using the Browser Source or docked browser panel features.
The reason for this has to do with how the operating system (Windows, Linux, Mac and virtually all other operating systems that support shared libraries) loads a program into memory, resolves addresses and initializes the software before handing control over to the program itself.
When the OS loads a program, one of the first things it does is look to see which libraries the program has been linked dynamically with. It then has to load a portion of the library into memory in order to resolve the addresses of symbols present in the library to initialize the software properly. This is true whether or not the given library actually gets used during this run of the software or not because it is a fundamental aspect for how dynamic linking works.
So in my example of OBS Studio and Google CEF above, a given person might never use the Browser Source feature built into OBS, nor the panel docks which use CEF. However even if they do not use these features that require CEF, because the program itself provides these features for someone to optionally use, the software must be built in a way that the library addresses are resolved at load time so the software can work properly if these features are actually used.
This is the exact same reason why the GOG galaxy DLL is present in all GOG games which have optional Galaxy functionality such as achievements, or other features. In order for any game to even be able to optionally use any Galaxy feature, just like using freetype library or Google CEF, the program must be linked with the libraries that it is using to implement any particular functionality so that the operating system is able to make these libraries functionality available to the program at run time should it end up using them.
So just because a program includes some DLL files in its installation and they get initialized by the operating system to resolve dynamic addresses in memory, none of the libraries actually get used unless the program actually uses a feature within the given library. So if a game for example has Galaxy achievements functionality available - but someone is not using Galaxy at all, perhaps having installed from standalone installers, then the Galaxy functionality is simply not used at all by the program - but the library still needs to be present in order for the operating system to be able to resolve the addresses it uses at program load time because that is how all operating systems work. The operating system has no idea which features or optional features a program may use or not use, it simply has to ensure that all of the libraries are able to be loaded if they are needed and the addresses are unique so proper operation can occur.
The DLL file itself contains the symbol table of all of its functions, global variables etc. present in the library which the operating system needs to access in order for this load time address resolution to function, and without it the program simply will not load because the operating system's dynamic linker can not resolve the addresses of the library.
Before shared libraries (DLLs) were used, all programs used what is called static linking, where when the software is built, all of the libraries it uses are linked at compile time into a single executable. There are no DLL library files as they're all built directly into the program/game itself. In this case there would be no freetype.dll, libcef.dll or galaxy.dll file present in the software installation and nobody would get all worked up about finding a harmless galaxy file on their hard disk because it would be built directly into the program itself. It's still possible to do this but is frowned upon because it is a bit wasteful of memory in particular if multiple programs use the same library at the same time. That's one of the benefits of DLLs, is that the code present in the library can be shared between mutliple programs simultnaeously and consume less memory.
<continued below>