Discussion Locked

Visual Basic: Using DLL's vs Modules

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm in a quandry over whether to spend time setting up a common dll file for my program package. I thought using DLL's as "Best Pratice" or "Best of Breed". The following statement from an expert started me to thinking about this.

"If you don'twant to register DLLs, don't use them. Nothing says you have to. Make sure there are specific reasons you are creating DLLs. Mainly speed or to apply a 3-tier architecture especially if your DLL is going to reside on the server and is separating the UI from direct access to the data source. Also creating a DLL is not the same as a COM object. COM objects (that just happen to be compiled to DLL) have specific entry and exit points as well as using interfaces. There is a lot more to creatingCOM than just compiling a DLL."

My requirements are to:
- Provide access to about 100 functions from various programs
- Run no more than 4 of the programs at the same time
- Keep task sizes under 500K (This can be done w/o Dll)
- Make the programs understandable when I look at them a year from now
- Speed is not a problem
- Following program best practices. (Sometimes we have too many choices ... and sometimes not)

Could someone comment on whether I need to bother with creating a DLL or not?

4 replies

by rrv

for average 100 users, data access just use normal module and use pure ADO and enable pooling of connections. Use DLL only when you have some business logic in it and needs change or update on server[your dll] without affecting end users. Think about dlls when you use VB.NET or ASP.NET where all these problems are automatically handled with dll.

RV

by gregwright

RVLion and everyone else, please ignore the rating because your comments are helping me make up my mind. One issue I have with using DLL's that could be a show stopper is the sharing of variables. I would need a single copy of a group of variables in memory that is shared by the calling program and the DLL. Is this possible? How?

by jmiller1

Keep in mind that you can compile and distribute a DLL separately from your executable. If you need to modify code in a module (included in the executable package) you need to compile and deploy a whole new executable.

jm

by ytvsoftware

For Sharing of variables of a DLL and the given instance of the module just create in the DLL global variables. Access them from Set/Get fuctions as is considered at modern time the good practice. Remember that for the given process memory of the DLL is part of memory of the process. So other programs can not get access to the same values. Sharing data among processes using a DLL is posible but use other technic. The simplest to create a named special section.

This discussion is closed to new replies.