|
-
March 18th, 2001, 03:43 AM
#1
Why to use Dll?
Is it efficient to create dlls for a software than class modules/modules for non system level programming? Does more dlls affect the performance of the code and can cause it to crash? Do we have other alternatives?
-
March 18th, 2001, 07:53 AM
#2
Re: Why to use Dll?
Here are some reasons why DLL's are used, and why not:
- Code reuse, a dll can be called from any one application, so if you have some functions U use in deiiferent applications, DLLs are the way to go.
- Updating. When updating a program wich uses DLL's, you can update only those files wich need to be updated, this can reduce the size of you rupdate program drastically. If all was compiled to 1 exe, the file would be bigger, and would take longer. This is very useful when distibuting via the internet.
- If using DLLs, you must be careful with what you change. If other programs use your dll, you must be sure that when u change your dll, the other programs will continue to work. Say you add a parameter to a function, if the old program doesn't know of this, it will crash when using the function.
- Speed isuues, this is a double edged knife, if you use DLLs, the DLLs are loaded when needed (wich is good). This will cause your program to start faster, but I will take longer when the dll is used for the first time. When not using a DLL, the program starts slower, but will be faster when a class is needed.
I hope this gives you an idea wheter or not to use DLLs.
Tom Cannaerts
[email protected]
The best way to escape a problem, is to solve it.
-
March 19th, 2001, 12:14 PM
#3
Re: Why to use Dll?
Thanks for the speedy reply!!
But still I have doubt, that, do dlls cause more memory usage and resource utilization?
And more use of dlls makes the software vulnerable to crashes?
Thanks again.
-
March 19th, 2001, 03:14 PM
#4
Re: Why to use Dll?
The use of DLLs uses a bit more resources, but in most cases, this won't be more than just a few milliseconds.
A dll doesn't increase the risk for crashes, actually, it is safer because they run out of process. When it crashes, it will only crash the process it is running in, not the entire computer, so you can consider this even safer than running it in the app itself.
Tom Cannaerts
[email protected]
The best way to escape a problem, is to solve it.
-
March 19th, 2001, 07:32 PM
#5
Re: Why to use Dll?
Right now I am choosing language to program between VB and VC++. The most concern is running speed.Do you think the runnung speed to use VB to call algrism dll slower than the speed use VC++? Or the speed couldn't different too much? Thanks!
Best Regards,
Kevin Shen
Best Regards,
Kevin Shen
-
March 20th, 2001, 10:32 AM
#6
Re: Why to use Dll?
C++ dll's are known to be faster, but this will only be noticed with very complex calculations. Another point where VB loses to C++ is when it comes to strings, the larger they get the slower VB gets. The choise you make depends on what your capabilities are, that is, in VB wringting dlls is much easier because the VB compiler will take care of all the things behind the scenes, where in C++ you must do all the work.
That and the fact that VB is assumed to be easier than C++ are reasons to go for VB. So VB is fast creation, slower execution (in some cases that is).
If you absolutely need the best performance, and you know your way around in C++, this would be the obvious choise. So C++ is longer development times, better performance.
Once again, the answer to the question is: it depends
Tom Cannaerts
[email protected]
The best way to escape a problem, is to solve it.
-
March 20th, 2001, 09:57 PM
#7
Re: Why to use Dll?
I have an algrism written by .c, I want to compile it to dll.
1)Which running speed could be faster, Use VB GUI or VC++ GUI to call this .c dll? Or almost the same use vb or vc++?
2)I want to compile .c to dll, do you have some good web site or book can introduce to me on how to do it?
Thank you!
Best Regards,
Kevin Shen
Best Regards,
Kevin Shen
-
March 21st, 2001, 04:45 AM
#8
Re: Why to use Dll?
To answer to the first question I could just say that the calling of a dll is almost the same in speed. Calling a C dll from VB would be the same as calling it from C. The first time you call the dll, VB will be a little slower than C because he probably has to load some C function (wich when calling from C are probably already in memory), from then on, the speed should be almost the same.
I don't know anything about compiling a C dll, but you could check out the C++ board, wich is also located on CodeGuru.
Goodluck
Tom Cannaerts
[email protected]
The best way to escape a problem, is to solve it.
-
March 21st, 2001, 02:47 PM
#9
Re: Why to use Dll?
Do you think it's a good idea to use VB GUI to call .c dll and the running speed won't be hurt too much? VB GUI supposed to be better and easier to program compare with VC++, and many objects also fit well with VB. I can write complex calculation using c and compile it to .dll , then let VB call it.
Do you have some suggestion?
Thanks!
Best Regards,
Kevin Shen
Best Regards,
Kevin Shen
-
March 26th, 2001, 04:16 AM
#10
Re: Why to use Dll?
hi
have u meanaged to do it?
I have tried to include a VC dll into VB.
I try to do it using "add reference"
I have add it succesfully but is unbale to use it.
When i run it, i keep getting error messages.
Can give me some tips on how to do it?
thank you!
-
March 26th, 2001, 06:47 PM
#11
Re: Why to use Dll?
I haven't managed to program yet. I checked MSDN. I found the topic "Declaring a DLL Procedure" maybe useful to us.
If you have some tips, please tell me.
Best Regards,
Kevin Shen
Best Regards,
Kevin Shen
-
March 26th, 2001, 08:54 PM
#12
Re: Why to use Dll?
hi
yup that work for most dll files.
But for one particular function in kernel32.dll "createfile" it does not work.
I do not understand why.
thanks anyway.
-
March 27th, 2001, 12:14 AM
#13
Re: Why to use Dll?
Sorry...! I don't know, either. Maybe others can help?
Best Regards,
Kevin Shen
Best Regards,
Kevin Shen
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
|