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.
This function ensures XPCOM is started, creates the component registry if necessary, and starts global services. Notice the "if necessary". As of Mozilla 1.0,
NS_InitEmbeddingno longer causes XPCOM component discovery and registration (autoreg) in optimized builds. If your application requires automatic component discovery and registration to be run in an optimized build, you can add this code:#include "nsXPCOM.h" ... nsCOMPtr<nsIComponentRegistrar> registrar; nsresult rv = NS_GetComponentRegistrar(getter_AddRefs(registrar)); if (NS_FAILURE(rv)) return rv; rv = registrar->AutoRegister(nsnull); ...nsresult NS_InitEmbedding(nsILocalFile *aMozBinDirectory, nsIDirectoryServiceProvider *aAppFileLocProvider)
aMozBinDirectory:The Gecko directory containing the component registry and runtime libraries; or use
nsnullto indicate the working directory.
aAppFileLocProvider:The object that specifies to Gecko where to find profiles, component registry preferences and so on; or use
nsnullfor the default behaviour.
| Written by:Ellen Evans | Comments, questions, complaints?