[EMAIL PROTECTED] wrote:
> Currently I'm only linking to xpcomglue.lib and call XPCOMGlueStartup
> instead.
> I was basically following this strategy now:
> http://developer.mozilla.org/en/docs/XPCOM_Glue
There are three strategies listed on that page... you're using the
"standalone" form. Are you defining XPCOM_GLUE?
> But I'm unsure about the difference of XPCOMGlueStartup and
> XRE_InitEmbedding.
Yeah, this is a bit confusing and we need better docs. I will try to
explain, and I hope somebody will turn this into a reasonable page on
developer.mozilla.org:
XPCOMGlueStartup is only for use when using "standalone" linkage. It
dynamically loads the XPCOM libraries and so that you can call functions
provided from XPCOM: all of the NS_* functions declared in nsXPCOM.h. It
does *not* initialize XPCOM! It does *not* dynamically load the XRE_* functions.
After you have called XPCOMGlueStartup, you could call NS_InitXPCOM2 and
manually initialize everything... but there are a lot of tricks necessary to
get XPCOM started, and XRE_InitEmbedding has most of those tricks already,
so...:
Instead, you should call XRE_InitEmbedding. However, that functions hasn't
been dynamically loaded yet: you need to perform an extra dynamic-linking
step before you can call this function... in code, it would look something
like this:
static const nsDynamicFunctionLoad kXRESymbols[] = {
{ "XRE_InitEmbedding", (NSFuncPtr*) &XRE_InitEmbedding },
// If you need other XRE_ functions such as XRE_LockProfileDirectory,
// add them to the list here:
{ "XRE_LockProfileDirectory", (NSFuncPtr*) &XRE_LockProfileDirectory },
{ nsnull, nsnull }
};
XPCOMGlueLoadXULFunctions(kXRESymbols);
// Now you may call XRE_InitEmbedding
In summary, the sequence of functions you want to call is:
* GRE_GetGREPathWithProperties (if you don't know where XULRunner is installed)
* XPCOMGlueStartup
* XPCOMGlueLoadXULFunctions
* XRE_InitEmbedding
--BDS
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding