libraries (dynamic or not) can be 'anything' (data or executable code and more). I have seen dlls that are just piles of images or icons. But the most used format is executable code.
they work like this ... the dll has the executable binary machine code for a routine (or a full blown object, including its routines, whatever) and the linker has the main program load the dll into memory and jump to the correct offset, run the routine, and pop back to the main program memory area.
to do that you generally have a .h file in your code (so you have function headers and such to tell you what parameters etc are) and a .lib file (this may be optional, I forget) may be there to help the compiler and linker put it together, and a .dll file that just needs to exist in the path when the program is running. Calling the functions from the .h file should work when you compile and run the code. At least in visual studio, simply adding the .h and the .lib (if any) to the project and having the .dll file in the path/scope is all you need to do to call the functions in the .h file.
later, you can change the .dll file and run the program with the updated code and it will still work, if the dll interfaces are the same. This is a good way to update programs with smaller files rather than resend everything every time you need to update.
try a simple one; there are many simple to use examples on the web, eg the zlib compression library can be had in a dll and its pretty easy to use.
A DLL (dynamic link library) is a way to reduce the memory usage on a computer. It can let a program load new features after the program was created, but I think that's a lesser used aspect.
Consider a windows program. It uses a bunch of code to draw windows, move windows, minimze and maximize windows, etc. A lot of this code is in a library. With "static linking", a copy of the library code gets put into the windows program.
Now consider that there might be 2 windows programs, or 20, or 4,000. They all use that windows library to some extent or another and if they all have their own copy of the code, then each program is bigger than it needs to be. Also, because it's bigger, it takes longer to load and takes up more RAM. Yuck. How can we fix this?
What if we allowed each program to share a copy of the library code? The operating system could "load" the library (read it from disk into RAM) "dynamically" (whenever it's needed). That is the essence of a DLL. It's a library of shared code that gets loaded when needed. It can also be unloaded when it's no longer needed.
Hope this helps. My background is UNIX so some of what I've said might not apply right to windows. I'm sure others will correct me.
I don't know what kind of project you're doing, but usually, if you want to use
a pre-existing library from, say, an SDK (Structured Development Kit) it will have the .h files (headers) in there. You then add the SDK to your include path and use the functions.
Depending on the SDK, they will sometimes add the 'extern __declspec(dllimport)' tag for you (this means you want to use an external function from a DLL).
Check out this example from the Microsoft docs. It shows a simple DLL internally, and a simple application that uses the DLL: