Libraries are confusing me.

I've looked for some info on how libraries and linkers work on wikipedia and some other sites but it's all just confusing me. For the most part I just want a little verification that I'm getting the right picture.

From what I'm understanding:
Object files are like templates, or blueprints for your code. They've got the full details of your program's structure, but practically, they're useless until you apply it by linking the object files into libraries, which can be accessed by the master executable. The libraries can't be executed, like the object files, but they're now structured in a way that the executable can use them. The executable builds a table of all the different subroutines so it can quickly access them when another subroutine requests another subroutine. The executable jumps between the libraries to determine what it should do next. (If the code is in the libraries, what's in the executable?)

Also, what's the difference between a dynamically linked library and a static one? That's really confusing me. And libs. Don't know what those are.
You got all that right.
In the executable is all the code you wrote, plus all the code that was statically linked.

A statically linked library is, shall we say, inserted into the executable at link time. That's why it's called static.
A dynamically linked library is linked at run time by, if I'm not mistaken, the OS.

Libs are static libraries. They are so called because of their extension in Windows (*.lib).
Oh, wow, I got something right for once XD. So when I'm looking at a 200mb file, the file's like that because there's statically linked libraries embedded in it? One more question though. How could I configure whether or not I want my program to use dll's or lib's? I could separately configure each source file to get a mixture of static and dynamic libraries, right?

Thanks for your help, I thought my visualization of the concept was horribly distorted when I posted it :P
A 200 MB executable? That sounds unlikely.

You can't. If a library you're using needs a lib you'll have to link to it. If this lib needs a DLL, it'll link automatically to it (assuming it's available, of course). The only way not to use libs or DLLs (that is, other than the system libraries) is to not use libraries at all.
OK, after reading a bit more on wikipedia I've got a good idea how it works. There's something about the way wikipedia presents information that tends to really confuse me sometimes, but I've pretty much got it down. Thanks for helping me out, it's unbearable trying to learn C++ when you don't understand how your code compiles :P
Topic archived. No new replies allowed.