|
-
Jul 12th, 2010, 07:27 PM
#1
Thread Starter
Lively Member
how and when should I use DLL files...?
well im not to good with DLL files-i usually just get all the code in the main app...Is that bad? Or is it better to use DLLs, if so why? What should I make DLLs for? the save function? open? Please help- Thanks.
-
Jul 12th, 2010, 07:55 PM
#2
Re: how and when should I use DLL files...?
DLLs are not for any specific functions. A DLL is an executable file, just like an EXE. The difference is that an EXE has an entry point, so it can be run directly, while DLLs must be loaded by an EXE or another DLL.
If you're just starting out then you probably have no need of creating your own DLLs. The main purpose of DLLs is to provide a unit of executable code that is reusable. For instance, lets say that you have two applications that access the same database. You might put all the data access code into a single DLL and then reference that DLL from the two different EXEs. That saves you duplicating a bunch of code. If you create some custom controls, you might also like to put them into a DLL that you can then reference in future projects rather than recreating them every time.
Other advantages of DLLs include the fact that they can make it easier for multiple developers to work on a project simultaneously, plus it means that a large application can load in parts rather than at startup in one huge EXE. These are of less interest to you when you're just starting out though.
-
Jul 12th, 2010, 08:57 PM
#3
Thread Starter
Lively Member
Re: how and when should I use DLL files...?
-im not just starting out-i just never knew what exactly DLLs were for...Im my current application should I make a DLL for functions like a save function new open etc...and im not too sure about what you mean by the reusable code...?
-
Jul 12th, 2010, 09:19 PM
#4
Re: how and when should I use DLL files...?
"reusable code" is code that is reusable, i.e. code that can be used in more than one place without having to be written more than once.
Why exactly do you think you should create a DLL for functions like save, new, open, etc? What do you think you would gain by doing so?
-
Jul 12th, 2010, 09:34 PM
#5
Thread Starter
Lively Member
Re: how and when should I use DLL files...?
well because i use the save function a real lot-i make it save before checking for updates before closing, autosave...etc....
-
Jul 12th, 2010, 09:49 PM
#6
Re: how and when should I use DLL files...?
And how does putting a function that you use a lot into a separate DLL help?
-
Jul 12th, 2010, 10:23 PM
#7
Thread Starter
Lively Member
Re: how and when should I use DLL files...?
i dont know-im not sure what a dll is actually for...
-
Jul 12th, 2010, 10:32 PM
#8
Re: how and when should I use DLL files...?
 Originally Posted by reconrey
i dont know-im not sure what a dll is actually for...
That would be why I explained what they're for in post #2. Do you need to do any of the things that I said you can do in post #2? If not then that would suggest that you don't need to create a DLL, right?
-
Jul 13th, 2010, 12:25 AM
#9
Thread Starter
Lively Member
Re: how and when should I use DLL files...?
i wasnt sure what u where saying...
-
Jul 13th, 2010, 12:29 AM
#10
Re: how and when should I use DLL files...?
What part don't you understand? You asked what "reusable code" meant. I explained it again, even though I had already given examples. Do you not understand the examples? Do you not understand the explanation? Is there some other issue?
-
Jul 13th, 2010, 10:14 AM
#11
Thread Starter
Lively Member
Re: how and when should I use DLL files...?
what do you mean by all the data acsess code?
-
Jul 13th, 2010, 11:26 AM
#12
Re: how and when should I use DLL files...?
JMC gave you an example of the type of code you can put into a library. You use .dll already without even knowing it. If you have created an application and used a button, where does that button come from?
Nearly all applications have at least 1 or 2 buttons, and does every developer create the code for the button? No, they use the code that is inside a .dll This same code is shared between multiple applications. They are libariaries of code.
Another example would be a writing 2 different games of cards. Now the first game uses a function to shuffle the cards in a random order. When you write the second game, you want access to the same function to shuffle. If the code to shuffle was inside the first game, you could not use it, however, if that code was put into a dll instead both games could access the same dll and could both shuffle .
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|