difference in libs and dll's

Started by
1 comment, last by oler1s 14 years, 2 months ago
I am new to the c language but I am not new to programming. Even though I have not been programming for a very long time in c, I caught on to everything fairly quick. To be honest with you I just started like 5 days ago and I am getting a hang of using the directx sdk library I just wanted to make that clear so everyone can understand where I coming from. because for some people, not understanding dll's or lib's mean's not understanding the c language, which is not entirely true. I wanted to get into mod making and playing around with engines such as allegro. one of my weaknesses is Dll's and libraries. But mainly because there's not enough resources (where there should be) that cover's the topic. Or at least to an extent that i understand them, I maybe just slow. O well, atleast I am making a effort to learn. So let's make this post a special one for all the special kids out there trying to learn about lib's and dll's I am going to list all the things I know about dll's and libs. and you guy's can tell me what I don't know. And I am doing this sincerely so I appreciated if you do too. Thanks! ------------------------------------------------------------------------------ I know it's like a .exe file except I can not run it directly. and i know it contains resources like functions and varibles. I also know that in order to create it, I must go into VC++ and click on new/project/new project/class library I know that Stdafx.cpp and Stdafx.h must be included in the project and I must atleast include the Stdafx.h into my dll file. I do know that in order to use a .dll file. I must include them in general properties/linkers/general/link library dependencies I also know that .libs are like dll's. What i don't know... I don't what the difference between a .lib and a dll is. I don't know if I must include them both I don't know if I should include them independently. I don't know if I can embed them all in one file. I don't know if I can include an entire folder And last, I dont know nothing at all. (for all the smarty pants out there!) feel free to correct me on what I do know. Thanks GUYS!!!!
Advertisement
Moved to For Beginners.
Quote:I also know that in order to create it, I must go into VC++ and click on new/project/new project/class library
That just sets up the project configuration appropriately. When you go to configure the project configuration, you can choose what you want (an exe, a DLL). I almost always start with an empty project and configure appropriately.

Quote:I know that Stdafx.cpp and Stdafx.h must be included in the project and I must atleast include the Stdafx.h into my dll file.
No. stdafx.h and cpp are the default names used for precompiled headers. Creating a shared library in no way requires using precompiled headers.

Quote:I do know that in order to use a .dll file. I must include them in general properties/linkers/general/link library dependencies
No. You do not link to DLLs. You only link to static libraries.

Quote:I also know that .libs are like dll's
Yes and no. In some sense, they can help achieve similar goals (precompiled usable code), but they are different. DLLs are Windows specific way of achieving shared libraries. Libs are compiler specific static libraries.

Quote:I don't know if I must include them both
What confuses people is the import library. So, let's say you have a DLL you want to use in your program? How can you use it? You could write a whole bunch of ugly code to load it at runtime, etc. It's painful plumbing work, and sometimes, you need to do it (example, a plugin system of DLLs).

But typically, you know at compile time what DLLs you depend on. Compilers often emit a static library along with a dynamic library. This static library has the code to do all the loading, thus freeing you from the plumbing work.

Quote:I don't know if I should include them independently. I don't know if I can embed them all in one file.
As I noted, you do not include DLLs at compile time. They are separate binaries. They are loaded at runtime.

Quote:I don't know if I can include an entire folder
This makes no sense in context of what you asked previously. Explain to us what effect you want achieved from "including an entire folder".

This topic is closed to new replies.

Advertisement