.NET Forum / .NET Framework / New Users / January 2007
difference between a .dll and .ocx????
|
|
Thread rating:  |
giddy - 22 Dec 2006 19:54 GMT 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
Scott M. - 22 Dec 2006 21:13 GMT .ocx files are files that contain code for ActiveX controls and ActiveX is just a specific type of COM interface.
> Hi , > i'm a C# with programmer with a prety good background , but i'm [quoted text clipped - 7 lines] > > gideon Milosz Skalecki - 22 Dec 2006 21:40 GMT 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.
 Signature Milosz Skalecki MCAD
> ..ocx files are files that contain code for ActiveX controls and ActiveX is > just a specific type of COM interface. [quoted text clipped - 10 lines] > > > > gideon Scott M. - 23 Dec 2006 16:14 GMT 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.
> What specific interface is that? :) > [quoted text clipped - 21 lines] >> > >> > gideon giddy - 28 Dec 2006 20:04 GMT 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 :). > [quoted text clipped - 3 lines] > > I was pointing this out. Scott M. - 29 Dec 2006 04:08 GMT 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)
>k then whats the diffeence between dlls and coms?? > [quoted text clipped - 13 lines] >> >> I was pointing this out. Carl Daniel [VC++ MVP] - 31 Dec 2006 19:49 GMT > 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
Scott M. - 01 Jan 2007 18:11 GMT >> The Component Object Model is an architectural standard. > [quoted text clipped - 4 lines] > > 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.
>> 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. If it contains a module that, in turn, contains functions, it surely is a COM library.
>> .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. Well, you are now talking about COM components, where as I am talking about the .dll or .exe adhering to the COM standard.
> -cd Peter Duniho - 01 Jan 2007 23:24 GMT >>> All .dll's >>> and .exe's (prior to .NET) as well as .ocx's comform to this standard [quoted text clipped - 4 lines] > 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.
>>> and so, they are all COM libraries. Whether or not they contain >>> class definitions or just function libraries is actually besides the [quoted text clipped - 5 lines] > 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
Carl Daniel [VC++ MVP] - 02 Jan 2007 04:44 GMT > Frankly, I find it a bit confusing that you could understand the > concept of a DLL adhering to the COM standard, without understand [quoted text clipped - 3 lines] > 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
Milosz Skalecki - 31 Dec 2006 13:17 GMT Microsoft say: "Keep in mind that an ActiveX control is just another term for an "OLE Object" or "Component Object Model (COM) Object."
 Signature Milosz Skalecki MCAD
> Sounds like you've answered your own question :). > [quoted text clipped - 29 lines] > >> > > >> > gideon Scott M. - 31 Dec 2006 16:38 GMT 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.
> Microsoft say: > "Keep in mind that an ActiveX control is just another term for an "OLE [quoted text clipped - 37 lines] >> >> > >> >> > gideon Milosz Skalecki - 01 Jan 2007 02:10 GMT 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.
 Signature Milosz Skalecki MCAD
> 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. [quoted text clipped - 41 lines] > >> >> > > >> >> > gideon Scott M. - 01 Jan 2007 18:13 GMT > Howdy Scott, > [quoted text clipped - 6 lines] > 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.
Carl Daniel [VC++ MVP] - 02 Jan 2007 04:42 GMT >> Howdy Scott, >> [quoted text clipped - 9 lines] > 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
Scott M. - 02 Jan 2007 13:57 GMT 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.
>>> Howdy Scott, >>> [quoted text clipped - 15 lines] > > -cd Carl Daniel [VC++ MVP] - 02 Jan 2007 15:35 GMT > 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
Milosz Skalecki - 22 Dec 2006 21:19 GMT Howdy,
Should be clear: http://support.microsoft.com/kb/159621
 Signature Milosz Skalecki MCAD
> Hi , > i'm a C# with programmer with a prety good background , but i'm [quoted text clipped - 7 lines] > > gideon Carl Daniel [VC++ MVP] - 31 Dec 2006 19:54 GMT > Hi , > i'm a C# with programmer with a prety good background , but i'm [quoted text clipped - 5 lines] > 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
Jo Varghese - 04 Jan 2007 08:58 GMT .Ocxs are the second generation controls, after .vbx . they are the CONTROLS which cud be activated in ACtiveX containers like Internet Explorer.
dlls are set of libraries or classes (may be COM or not) which is to be used (shared between) in other applications .
Jo Varghese - 04 Jan 2007 09:00 GMT .Ocxs are the second generation controls, after .vbx . they are the CONTROLS which cud be activated in ACtiveX containers like Internet Explorer.
dlls are set of libraries or classes (may be COM or not) which is to be used (shared between) in other applications .
Jo Varghese - 04 Jan 2007 09:07 GMT .Ocxs are the second generation controls, after .vbx . they are the CONTROLS which cud be activated in ACtiveX containers like Internet Explorer.
dlls are set of libraries or classes (may be COM or not) which is to be used (shared between) in other applications .
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|