Archived

This topic is now archived and is closed to further replies.

ScottC

In what situation would you need to program a DLL?

Recommended Posts

DLL''s are good for code alot of things. For code that never changes or changes rarely (GUI code for example). This allows you to send the DLL once to the consumer, then if any updates to the main app are needed, your executable doesn''t need the GUI code in it and it lowers your updated exe size, which saves on bandwidth and is faster for the consumer. It is good for AI, particle effects, vehicle/weapon setups. So if you change those, then all you have to send is just the updated DLL. So making DLL''s this way allows you to send updates over the net that only reflect what has changed, and not require to re-download the entire app/game just to get the new button textures.

Share this post


Link to post
Share on other sites
First of all, library programming is good for containing a module within a specific place that you can treat as a black box. You just expose an interface, coupled with a LIB/DLL file, and there you have it. You can couple a tester along with it, so that any change in the library will undergo the tests every time you change something, therefore making the whole thing more stable.

Now, DLLs are good for several reasons, some of which are:

1. They allow you to change the behavior of the program without recompiling everything. Given that the interface is maintained, you just compile the DLL and you''re good to go.

2. They allow you to not know what to link with in compilation time. For example, plug-ins. You can make a plug-ins manager based on incoming DLLs that all of them has a specific registration function which notify your manager about their capabilities (somewhat like COM).

There is one big disadvantage to DLLs, which explains the common phrase "DLL HELL", and it is related to versioning. When you compile statically with a LIB file - it''s over and done. You won''t have any interfacing problems later. However, in DLLs, you might be linking to a wrong version if you''re not too careful, which can obviously lead to problems.

Bottom line, I can''t see one specific rule of thumb to decide when to use DLLs or when not to.

Dubito, Cogito ergo sum.

Share this post


Link to post
Share on other sites