DLL and Com Object...

   I'm wondering what the difference is between a dynamic link library and a COM object.....

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
COM servers can be accessed across a network, and DLL's can't,
A .DLL file if the file that contains one or more functions compiled, linked, and stored separately from the processes that use them. The operating system maps the DLLs into the process's address space when the process is starting up or while it is running. The process then executes functions in the DLL

COM is the fundamental "object model" on which ActiveX Controls and OLE are built. COM allows an object to expose its functionality to other components and to host applications. It defines both how the object exposes itself and how this exposure works across processes and across networks. COM also defines the object's life cycle.

COM object :-
An object that conforms to the OLE Component Object Model (COM). A COM object is an instance of an object definition, which specifies the object's data and one or more implementations of interfaces on the object. Clients interact with a COM object only through its interfaces.

If two or more DLLs export the same functions (immutability), you can link either. However, a single application cannot use both DLLs, nor can they both reside on the same computer. The Component Object Model (COM) solves this problem. Two COM servers with identical interfaces (and therefore methods) can be used by two different applications and can reside on the same computer, because they have different class IDs (CLSIDs) and therefore are different binaries. Further, the two COM servers are technically interchangeable.

For more information on dlls, visit,
The term COM means many different things to many different people. On the one hand, the Component Object Model is a specification for writing reusable software that runs in component-based systems. On the other hand, COM can be thought of as a sophisticated infrastructure that allows clients and objects to communicate across process and host computer boundaries. Many developers who are already COM-savvy see it as a new programming style and a set of disciplines required to work in a Microsoft-centric environment. Business managers and system designers see COM as technology that's solving many of the problems the industry has experienced in maintaining and extending large information systems. COM is all of these things and more.

COM is a model based on binary reuse. This means that software (components) adhering to COM can be reused without any dependencies on source code. Developers can ship their work as binary files without revealing their proprietary algorithms. The reuse of code in a binary form also eliminates many compile-time problems that occur when systems are assembled according to a development style based on source code reuse. Binary reuse makes it far easier to incorporate small changes into a system. For instance, a minor bug fix or a performance modification can be made to a dynamic link library (DLL). The DLL can then be recompiled and replaced in the field without adversely affecting any of the client applications that use it. Systems based on source code reuse must typically recompile every line of code in the entire application. This requirement makes maintaining and extending software cumbersome and expensive.

The principles of binary reuse allow you to construct COM-based applications using language-independent components. When several teams are building components for a single system, each team can choose its programming language independently. Today's list of COM-enabled languages includes C++, Visual Basic, Java, Delphi, and even COBOL. Each team can select a language that matches its programming expertise and that gives it the best mix of flexibility, performance, and productivity. For instance, if one team requires low-level systems code, it can use C++ for the flexibility of the language. Another team writing and extending business logic for the same application can elect to use Visual Basic for its high levels of productivity. The ability to mix and match languages makes it easier for companies to make the best possible use of their existing pools of programming talent.

COM is based on object-oriented programming (OOP). This means that COM is a story about clients communicating with objects. COM exploits the OOP paradigm to achieve higher levels of reuse than is possible with other models of binary reuse. COM clients and COM classes typically live in separate binary files, as shown in Figure 1-1. COM specifies an infrastructure that enables clients to bind to objects at run time.

COM is interprocess-capable. This means that clients can create objects in separate processes and on remote computers. Thus COM serves as core technology in Microsoft's strategy for distributed computing. While both OOP and distributed programming have existed for well over a decade, the synergy of the two has produced a powerful new programming paradigm. It has never been easier to write a distributed application.

Why Use Visual Basic with COM?
Of all the COM-enabled development tools on the market, Visual Basic offers the highest levels of productivity. Visual Basic 3 and Visual Basic 4 both offered modest advancements in the product's COM-awareness, but Visual Basic 5 really opened the door to make this development tool a viable option for building components for use in COM-based systems. Visual Basic 6 continues to add to the COM capabilities of this development tool.

Take a moment to consider the following questions. What is your perception of Visual Basic? Does it provide a viable option for writing the code to be used in a large information system? Why are you reading this book? Respond to the following questions by choosing Visual Basic, C++, or Structured Query Language (SQL):

Which language is the easiest for writing business logic?

Which language offers the lowest cost of code maintenance?

Which language offers the fastest means to enhance an existing application?

Which is the best language for people without a classic computer science background?
Many designers and project leads answer these questions quickly by saying, "Visual Basic." Visual Basic is in no way a cure-all language. In many cases, C++ or some other language would be a better choice for a specific component. For instance, many system-level COM interfaces can be readily accessed only through C++, which means that some components should be written with C++. However, companies have many opportunities to use Visual Basic in a distributed application. One of the greatest opportunities for Visual Basic today is writing business logic and data access code for distributed objects in the middle tier of a large information system.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.