Hello everyone! Welcome to my another blog.. Last time, it was about pointers, today it will be about shared libraries, and everything around it, so lets begin! First, its good to know I will only be covering the Windows and Linux os's here, but don't worry apple fans, ios and macos are(or atleast were) both based on some version of BSD, so they should be more similiar to the linux version, so with that, lets begin! First of all, what is a library? Preety much, when you make an operating system, you should make an easy access to the system trough the standard library, and overall libraries are built to extend the functionality. There are couple of library types, mainly the precompiled library(sommonly .so, .o, .obj or .dll), which is already compiled by someone, and you can use it in your program with languages like C, then interpreted language library, which is commonly just a plain text file with the code just put there, for languages like python. It can also be preprocessed, for example how C# does, where the libraries(not focusing on the modern AOT that was just added) are just precompiled to something between compiled and interpreted, aka IL code in microsoft terms. Since interpreted library is just like copy pasting the code from other repository, I wont cover them here. Important(for now), are the objects(object libraries), and the shared objects(shared object libraries). Difference between these is, that the object library is an intermidiate object, and you can create them using the -c flag. They commonly serve as when you're trying to compile multiple files, to be able to make faster with multithreading, but personally I use these for when I need to provide the same file to multiple others, so I don't have to recompile the entire file agin and agin. These kinds of libraries are included INSIDE the executable, so if the object file would be 1gigabyte, the finished executable would have 1gb + the filesize of the executables code. This is something called static linking, which just means the executable doesn't depend on it. Now, lets get to the shared objects, shall we? Shared objects are type of libraries that are their own file, and the program uses the ones its provided, not the ones it has included inside of it, because it doesn't have any. Big advantage of this is the tiny file size. If every program had entire Clib inside of it, it would take like 2megabytes for each program even when striped(remove all the unneceseary parts of your program from the executable to make it smaller), which is quite alot. With shared libraries, the executable can be just about 20kb, which is notably smaller. The problem with this is, user might not have installed the said library on their system, and has to install it. This can come with all sorts of issues, but most common one is your system breaking randomly after installing some library. Your libraries are commonly stored in eighter /lib(/lib64) or /usr/lib(/usr/lib32[or 64]). So now, how can we archieve including those libraries in our executable? We can compile them like this: `gcc program.c library.o` `gcc program.c -llibrary` In the first example, I am just using the object file as if another source file included inside of the program.c, on the other hand with the shared object, I only have to specify the name, without specifying the path(I can tho using -L"/p/a/t/h"), because the system already knows where to find said library. Its also good to note that each library commonly includes a header file with it, unless its something really obvious. Header file is just a file where you put all the functions and global variables you need from the source file, and if you do it correctly you can then use the header to call functions from your library. Where are header files for your libraries tho? They are commonly on unix like systems in /usr/include, and they should already be in your path. Now, lets look at windows side of things. With windows, libraries are kind of weird and everything, and they are really confusing to work with, but I will still try to explain it in undestandable way. Some of the libraries on widows, system ones to be exact are located inside of the Windows folder or the Windows\System32 folder, depends on which. You commonly can't find the headers because its just broken, so you might want to use something like vcpkg to manage them for you. On windows programs, each program instead of borowing the shared library in the system, uses a different copy of the library(commonly conviniently located in its directory), resulting in hundreds of duplicate unneeded library files. This is also the consequence of bad design, and please really don't take advice from this windows thingy. Anyway, this will propably be all for today! I will see you up ahead..