DEV Community

Selfish Dev
Selfish Dev

Posted on

What is Dynamically Linked Library

WHAT

A Dynamically Linked Library (.dll) (on Windows) or Shared Library (.so) (on Linux) is a file that contains reusable code that programs can load while running, instead of being included inside the program itself.

(Think of it like the preload()function in Godot.)

EXAMPLE

Imagine you're developing a game using SDL and you compile your code like this:

g++ sdl.cpp -o sdl -lSDL2
Enter fullscreen mode Exit fullscreen mode

Every time you update your code, you must recompile the entire program. This is time-consuming and frustrating, especially for large projects.

Instead, we can divide our game into multiple DLLs.

By moving different parts of the game (like physics, audio, and rendering) into separate DLLs, you can update only those parts without recompiling the entire game. Once the DLL is updated, your main sdl.cpp file automatically picks up the changes.

its literally like a magic

Benefits

  • Smaller programm
  • Easy to update
  • Reusable

Top comments (0)