Use of DLLs

This is a discussion on Use of DLLs within the C++ Programming forums, part of the General Programming Boards category; I was wondering how extensive the use of DLLs in c++ is. I just learned how to make them(although I ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    75

    Use of DLLs

    I was wondering how extensive the use of DLLs in c++ is.

    I just learned how to make them(although I dont think Ive fully grasped the subject).

    Thanks in advance.

  2. #2
    Registered User
    Join Date
    Dec 2002
    Posts
    56
    Originally posted by Salem
    DLLs are nothing to do with C++

    You'll only find DLLs in windows programming, where they are used by other languages, not just C++.
    The fact that DLL's can be written in C++ implies a relationship. The OP never implied that relationship was exclusive.

    I think the question still stands - are DLL's very common in C++ [Windows] applications, or does the language provide better (perhaps even cross-platform) alternatives?

  3. #3
    Xei
    Xei is offline
    Registered User Xei's Avatar
    Join Date
    May 2002
    Posts
    719
    DLL's are very widely used. Without them you would be importing thousands and thousands of lines of code into each of your wonderful windows applications. Other systems use different methods but the same principals remain.
    "What are you after - the vague post of the week award?" - Salem
    IPv6 Ready.
    Travel the world, meet interesting people...kill them.
    Trying to fix or change something, only guaruntees and perpetuates its existence.
    I don't know about angels, but it is fear that gives men wings.
    The problem with wanting something is the fear of losing it, or never having it. The thought makes you weak.

    E-Mail Xei

  4. #4
    Registered User
    Join Date
    Jan 2002
    Posts
    75
    So what determines the need of a DLL?

    In what instances should I myself create a dLL.

    (exempted cross language material, I do not believe I will be getting into that....)

  5. #5
    Xei
    Xei is offline
    Registered User Xei's Avatar
    Join Date
    May 2002
    Posts
    719
    In order to understand DLL's you must think about what it was like for a programmer in the past. Think about having only 2 megabytes(for example, rather than a realistic value) for the data on a computer. Now think about having to re-write code to do the same thing over and over again, such as a dialog box or a button. So lets look at msvcp60.dll, it's 389KB - Please keep in mind this is simply an example - So lets just say that everything this programmer wants to use is in that dll. Now without using that DLL he would be able to put approx. 5 programs; but with using the dll (we'll say the average execution is 45kb) he could put approx. 36 applications. This is simply for the sake of example to help you understand why libraries like DLL's were ever needed. However, now there are many different reasons to use DLL's. In operation systems like Windows, DLL's don't only save space and time programming but they create the framework for the operating system. Even the games you play use DLL's, everything from runtimes to DirectX or OpenGL. There is so much information on DLL's from the naming conventions to their benefits and uses. Also, getting into language-specific DLL's is a complicated topic because you can make DLL's in ASM, C, C++, VB, etc.. and they can all be compatible with eachother depending on how you build them. You should create yourself a DLL in instances when you will be creating large applications, because those applications will need some sort of framework then it only makes logical sense to have a DLL incase if you want to upgrade afew functions, the interface, or if another programmer is assigned to the job(in which case you hopefully documented your code well). Anyways, there are so many useful features to using DLL's. I hope this helps you understand why they are so important.
    Last edited by Xei; 06-17-2003 at 02:16 PM.
    "What are you after - the vague post of the week award?" - Salem
    IPv6 Ready.
    Travel the world, meet interesting people...kill them.
    Trying to fix or change something, only guaruntees and perpetuates its existence.
    I don't know about angels, but it is fear that gives men wings.
    The problem with wanting something is the fear of losing it, or never having it. The thought makes you weak.

    E-Mail Xei

  6. #6
    Registered User
    Join Date
    Jan 2002
    Posts
    75
    So basically if I was making a large application, it would make sense to use DLLs.

    But what all do you place in a DLL?

    Functions? Classes? Templates?
    Defines? or what?

    I think Im beginning to understand the use of a DLL...

    Lets say I make a huge application, but later on I want to make a few global changes, Instead of rewriting all sorts of code here and there, just rewrite the Library and replace the old one. Correct?

    So like I said, what all would a DLL contain?

    Or is that just up to the programmer, or just up to common sense?
    MSVC++~

  7. #7
    Xei
    Xei is offline
    Registered User Xei's Avatar
    Join Date
    May 2002
    Posts
    719
    Well your classes, templates, and defines go into the header file that you include for the use of your DLL. But your DLL normally would have functions that your application uses. Okay, lets say that one day you are hired to create a file sharing client/server that profits by displaying AD's to its users. So, depending on the programmer's preferences, he could do the following:

    -DLL for socket operations (downloading, connections, etc.)
    -DLL for displaying JPEG's, etc.. on DC's for skinning and AD displaying.
    -DLL for encryption and file handling.
    -DLL for playing media files
    -Then the Execution.

    Now that framework could be good for years. But lets say that the company that you were retreiving AD's from went bankrupt or something, so now you create a new AD control DLL and all is fine. Why have to re-code and re-compile the entire thing when all you have to do is compile a simple DLL? Or, lets say you are hired to make an application which requires the use of the internet... but you already have made a DLL for socket operations so you save time by just using that library.

    DLL's are also sold for specific purposes such as compression, encryption, image rendering, etc. There are many purposes.
    "What are you after - the vague post of the week award?" - Salem
    IPv6 Ready.
    Travel the world, meet interesting people...kill them.
    Trying to fix or change something, only guaruntees and perpetuates its existence.
    I don't know about angels, but it is fear that gives men wings.
    The problem with wanting something is the fear of losing it, or never having it. The thought makes you weak.

    E-Mail Xei

  8. #8
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    >> So basically if I was making a large application, it would make sense to use DLLs.

    Not quite (though chances are you'd find things in large programs that'd make good DLLs). If you were looking to make ten applications (of whatever size) that incorporated the same functionality, then you'd want to incorporate that functionality into a DLL. Anything that would make sense as a reusable and independent component is a candidate for becoming a DLL.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Protection of DLLs
    By Poche in forum C# Programming
    Replies: 5
    Last Post: 06-04-2009, 08:30 PM
  2. Some doubts on DLLs
    By BrownB in forum Windows Programming
    Replies: 1
    Last Post: 05-30-2007, 02:25 AM
  3. standart dlls
    By keeper in forum C++ Programming
    Replies: 3
    Last Post: 07-05-2006, 07:32 PM
  4. Can't load string from resource DLL's string table
    By s_k in forum Windows Programming
    Replies: 4
    Last Post: 07-15-2003, 06:43 AM
  5. question about DLL's and class functions
    By btq in forum Windows Programming
    Replies: 2
    Last Post: 02-25-2003, 05:08 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21