You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.


TOC PREV NEXT INDEX

Embedding Gecko API


XPCOM Startup/Shutdown


These C++ functions serve to initialize and terminate XPCOM. (In an embedding situation, this is usually taken care of by embedding initialization.) Also included are a number of global functions that provide access to the main XPCOM components.

Note: These are C++ functions only, and are therefore not scriptable.

NS_InitXPCOM2

Initializes XPCOM. This function must be called before using XPCOM. The one exception is that you may call NS_NewLocalFile to create an nsIFile object to supply as the bin directory path in this call.

Syntax:

extern "C" NS_COM nsresult NS_InitXPCOM2(
	nsIServiceManager* *result,nsIFile* binDirectory,
	nsIDirectoryServiceProvider* appFileLocationProvider) 

Parameters:

result: The service manager. You may pass null.
binDirectory: The directory containing the component registry and runtime libraries. You can use nsnull to use the working directory.
appFileLocProvider: The object to be used by Gecko that specifies to Gecko where to find profiles, the component registry preferences and so on. You can use nsnull for the default behaviour.

nsresult

NS_OK if successful.
Other error codes indicate failure during initialization.

See also: see NS_NewLocalFile, nsILocalFile, and nsIDirectoryServiceProvider.

NS_ShutdownXPCOM

Shuts down XPCOM. This function must be called when you are finished using XPCOM.

Syntax:

extern "C" NS_COM nsresult NS_ShutdownXPCOM(
	nsIServiceManager* servMgr) 

Parameters:

servMgr: The service manager which was returned by NS_InitXPCOM2. This will release the service manager. You may pass null.

nsresult:

NS_OK if successful.
Other error codes indicate failure.
NS_GetServiceManager

Accesses the Service Manager.

Syntax:

extern "C" NS_COM nsresult NS_GetServiceManager(
	nsIServiceManager** result) 

Parameters:

result: An interface pointer to the service manager.

nsresult:

NS_OK if successful.
NS_GetComponentManager

Accesses the Component Manager.

Syntax:

NS_COM nsresult NS_GetComponentManager(
	nsIComponentManager** result) 

Parameters:

result: An interface pointer to the component manager.

nsresult:

NS_OK if successful.
NS_GetComponentRegistrar

Accesses the Component Registration Manager.

Syntax:

NS_COM nsresult NS_GetComponentRegistrar(
	nsIComponentRegistrar** result)  

Parameters:

result: An interface pointer to the component registration manager.

nsresult:

NS_OK if successful.
NS_GetMemoryManager

Accesses the memory manager.

Syntax:

NS_COM nsresult NS_GetMemoryManager(nsIMemory** result) 

Parameters:

result: An interface pointer to the memory manager

nsresult:

NS_OK if successful.

Written by:Ellen Evans | Comments, questions, complaints? Bug 143387
TOC PREV NEXT INDEX