Doug Chartier wrote:

> Why does Mozilla use XPCOM?  A while ago, I read a message in this
> newsgroup  indicating that XPCOM's purpose was to allow one to create
> components, accessible through interfaces.  I agree that this scheme
> is good, but one can accomplish this goal using standard abstraction
> techniques in standard C and C++.  Can someone explain the benefits of
> XPCOM?
> 
> Thanks!
> 
I'll take a stab at this.


First, there is the DLL (or shared library) hell issue. XPCOM
deals with this by keeping the number of symbols that actually
need to be exported by a DLL/shared library down to a handful
(five I think).


Second, there are the logical abstractions of a component and
an interface. The QueryInterface mechanism allows an XPCOM client
to discover whether a component supports an interface familiar
to the client.

Third, the lifetime of a component can be managed through the
AddRef/Release methods that each interface of every component
must support. Generally each component holds a reference count.
When that reference count decreases to zero, the component
destroys itself.

Fourth, XPCOM offers interface description through the use of an
IDL and an IDL compiler (xpidl). This permits supporting components
in a language neutral way so that other languages like Javascript,
Perl, and Python can use and even implement an XPCOM component.

What are the advantages of XPCOM over using "standard
abstraction techniques in standard C and C++" ? Each of the first
three points above is implemented using the standard abstraction
techniques you mention above. XPCOM provides a specific
guideline - a convention or standard - for accomplish these
goals. This convention allows large groups of people to
construct components that work together because their
components adhere to an XPCOM standard.

Regards,
Rick


Reply via email to