difference between a .dll and .ocx????

G

giddy

Hi ,
i'm a C# with programmer with a prety good background , but i'm
embarrased to admit i'm still not clear about dlls and ocx's

i've seen a good set of links and i did'nt get much out of them.. .so
could someone tell me :

the difference between a .dll and .ocx???? .... also. .are ocxs
activeXs or COM (or both! =S)

gideon
 
S

Scott M.

..ocx files are files that contain code for ActiveX controls and ActiveX is
just a specific type of COM interface.
 
G

Guest

What specific interface is that? :)

An ActiveX control is essentially a simple OLE object that supports the
IUnknown interface (methods QueryInterface, AddRef, Release), the same as all
COM objects. It usually supports many more interfaces in order to offer
functionality, but all additional interfaces can be viewed as optional.
ActiveX Controls must also support self-registration by implementing the
DllRegisterServer and DllUnregisterServer functions.
 
S

Scott M.

Sounds like you've answered your own question :).

You are now talking about the differences between OLE objects and ActiveX
controls, but remember that was not the question. Not all COM components
are OLE objects.

I was pointing this out.
 
G

giddy

k then whats the diffeence between dlls and coms??

COMS : component OBJECT model? /
dll : dynamic link library

so .... are coms class libraries[object oriented] ?? and dlls could
just be a huge bunch of plain functions , NON-OBJECT oriented(like the
win32 API) . .like user32 , kernel32 etc.. .
Gideon
 
S

Scott M.

The Component Object Model is an architectural standard. All .dll's and
..exe's (prior to .NET) as well as .ocx's comform to this standard and so,
they are all COM libraries. Whether or not they contain class definitions
or just function libraries is actually besides the point. .dll's may or
may not contain class definitions (but usually do)


giddy said:
k then whats the diffeence between dlls and coms??

COMS : component OBJECT model? /
dll : dynamic link library

so .... are coms class libraries[object oriented] ?? and dlls could
just be a huge bunch of plain functions , NON-OBJECT oriented(like the
win32 API) . .like user32 , kernel32 etc.. .
Gideon

Sounds like you've answered your own question :).

You are now talking about the differences between OLE objects and ActiveX
controls, but remember that was not the question. Not all COM components
are OLE objects.

I was pointing this out.
 
G

Guest

Microsoft say:
"Keep in mind that an ActiveX control is just another term for an "OLE
Object" or "Component Object Model (COM) Object."
 
S

Scott M.

Well, not quite since not all OLE objects are ActiveX objects. But,
nonetheless, what's your point? The OP is asking about .dlls and .ocxs.
You seem to be hung up on OLE and ActiveX.
 
C

Carl Daniel [VC++ MVP]

Scott said:
The Component Object Model is an architectural standard.

that's true.
All .dll's
and .exe's (prior to .NET) as well as .ocx's comform to this standard

That's not true.
and so, they are all COM libraries. Whether or not they contain
class definitions or just function libraries is actually besides the
point.

That's not true. if a DLL does not expose any COM classes then it cannot in
any way be called a COM library. It's just a DLL.
.dll's may or may not contain class definitions (but usually
do)

If a DLL doesn't contain class definitions, then it's not a COM component,
simple as that. Most DLLs do not contain COM compoents.

-cd
 
C

Carl Daniel [VC++ MVP]

giddy said:
Hi ,
i'm a C# with programmer with a prety good background , but i'm
embarrased to admit i'm still not clear about dlls and ocx's

i've seen a good set of links and i did'nt get much out of them.. .so
could someone tell me :

the difference between a .dll and .ocx???? .... also. .are ocxs
activeXs or COM (or both! =S)

A DLL is a loadable image that contains code and/or data and/or resources.

An OCX is a DLL that contains the implementation of one or more OLE
automation compatible COM objects and includes and embedded type library as
a resource. Typically the OCX extension has been used only for "Active X
Controls" that work in VB6, but it could contain any kind of COM object with
an embedded type library.

An OCX is about the closest thing to a .NET assembly that exists in pure
native code, as it contains both the implementation of one or more classes
and meta-data (the type library) that describes the interface(s) to those
classes.

-cd
 
G

Guest

Howdy Scott,

My point was sentence written by you:
"ActiveX is just a specific type of COM interface." which i disagreed. From
architectural point of view, COM, OLE, ActiveX objects have to only implement
IUnknown interface. It's not a specific or special type of COM interface it's
just another name for the same technology. See Microsoft spec:

http://support.microsoft.com/kb/154544/EN-US/

especially:

"ActiveX controls, formerly known as OLE controls or OCX controls,.. "

and

"Q. What is the difference between an OLE control and an ActiveX control?

A. No difference. "ActiveX control" renames and restructures the OLE
controls technology. For marketing reasons, the term OLE has come full circle
and once again refers to the OLE technologies that apply to object linking
and embedding only. The term "OLE control" has been replaced with the
"ActiveX control" to distance the name from the older Object Linking and
Embedding technology with which controls have very little in common. No one
should use the term "OLE control" anymore."

1. Q. What is the difference between an OLE control and an ActiveX control?
A. No difference. "ActiveX control" renames and restructures the OLE
controls technology. For marketing reasons, the term OLE has come full circle
and once again refers to the OLE technologies that apply to object linking
and embedding only. The term "OLE control" has been replaced with the
"ActiveX control" to distance the name from the older Object Linking and
Embedding technology with which controls have very little in common. No one
should use the term "OLE control" anymore.
 
S

Scott M.

Carl Daniel said:
that's true.


That's not true.

How so? If (prior to .NET), you built an .exe or .dll (that runs on
Windows), then it must be a COM library since, that's the architecture that
Windows is built on.
That's not true. if a DLL does not expose any COM classes then it cannot
in any way be called a COM library. It's just a DLL.

If it contains a module that, in turn, contains functions, it surely is a
COM library.
If a DLL doesn't contain class definitions, then it's not a COM component,
simple as that. Most DLLs do not contain COM compoents.

Well, you are now talking about COM components, where as I am talking about
the .dll or .exe adhering to the COM standard.
 
S

Scott M.

Milosz Skalecki said:
Howdy Scott,

My point was sentence written by you:
"ActiveX is just a specific type of COM interface." which i disagreed.
From
architectural point of view, COM, OLE, ActiveX objects have to only
implement
IUnknown interface. It's not a specific or special type of COM interface
it's
just another name for the same technology. See Microsoft spec:

But hold on a sec. ActiveX (and OLE) are specific types of COM libraries.
You can't very well say that all COM libraries are ActiveX.
 
P

Peter Duniho

Scott M. said:
How so? If (prior to .NET), you built an .exe or .dll (that runs on
Windows), then it must be a COM library since, that's the architecture
that Windows is built on.

You are basing your conclusion on false assumptions. Windows is NOT built
solely on COM, nor would the architecture on which Windows is built
necessarily define what some .exe or .dll not part of Windows (even if it
runs on Windows) is or is not.

The main difference between a .exe and a .dll is that the .exe is entirely
self-contained with a well-defined entry point where a program can start
executing. There have been .exe files since long before Windows. A .dll
also has a well-defined entry point, but it doesn't define where execution
of a program begins...instead, it's a function that is called when the DLL
is loaded (there are also special functions called when the DLL is unloaded
and for other events).

Other than these few special functions (which have nothing to do with COM),
a DLL is not required to implement anything else. It always does, of
course, since otherwise it wouldn't be useful. But what it does implement
is up to the person authoring the DLL. Most DLLs are simply a collection of
useful functions. For example, the Visual Studio C runtime library, which
is very much like a statically-linked CRT except that it can be shared by
all the various executables that use it. It has nothing to do with COM, and
it is not a COM library.

There is no requirement for a DLL to support the specification required by a
COM object, and a great many DLLs do NOT implement COM objects.
Furthermore, just as EXE files have been around for much longer than Windows
has, Windows itself has been around much longer than COM has been. There is
still a lot in Windows that has absolutely nothing to do with COM, even the
parts of Windows implemented in DLLs.
If it contains a module that, in turn, contains functions, it surely is a
COM library.

It is not. A DLL that does not contain the requisite "factory" API and
which does not implement the other necessary elements of COM is NOT a COM
library. How could it be?

If the definition of "COM library" was "a module that contains functions",
you'd be right. But that's not what a COM library is, and so your
conclusion is simply wrong.
[...]
If a DLL doesn't contain class definitions, then it's not a COM
component, simple as that. Most DLLs do not contain COM compoents.

Well, you are now talking about COM components, where as I am talking
about the .dll or .exe adhering to the COM standard.

Frankly, I find it a bit confusing that you could understand the concept of
a DLL adhering to the COM standard, without understand that a DLL need not
adhere to the COM standard. If there is a standard that a DLL may adhere
to, rather than simply being a DLL, doesn't it also logically follow that
there may be DLLs that do not adhere to that standard, and thus are not in
the category of components that DO adhere to that standard?

Pete
 
C

Carl Daniel [VC++ MVP]

Scott said:
But hold on a sec. ActiveX (and OLE) are specific types of COM
libraries. You can't very well say that all COM libraries are ActiveX.

It's nearly true. MSFT re-defined exactly what an Active-X control a few
times with the final defintion being basically "any self-registering
in-process COM server".

-cd
 
C

Carl Daniel [VC++ MVP]

Peter said:
Frankly, I find it a bit confusing that you could understand the
concept of a DLL adhering to the COM standard, without understand
that a DLL need not adhere to the COM standard. If there is a
standard that a DLL may adhere to, rather than simply being a DLL,
doesn't it also logically follow that there may be DLLs that do not
adhere to that standard, and thus are not in the category of
components that DO adhere to that standard?

It makes perfect sense if Scott is/was a VB6 programmer, as all DLLs
produced by VB6(5/4/3...) are in fact COM DLLs. Of course, that's not the
case for DLLs in general, as we've both already covered in detail.

-cd
 
S

Scott M.

But not all COM libraries are self-registering, nor are all of them
in-process servers. So, that means that not all COM libraries/objects are
ActiveX.
 
C

Carl Daniel [VC++ MVP]

Scott said:
But not all COM libraries are self-registering, nor are all of them
in-process servers. So, that means that not all COM
libraries/objects are ActiveX.

Correct. Not all COM libraries are Active-X controls.

-cd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top