Hi,

I made the changes you sugested, which gave me a linking error with 
PR_GetCurrentThread. So I followed the instructions here : 
http://developer.mozilla.org/en/docs/XPCOM_Glue I assume after defining 
XPCOM_GLUE_USE_NSPR I also have to link in nspr4.lib?

Anyway after it's compiling I recieve a NS_ERROR_FAILURE from 
NS_InitEmbedding, which doesn't really tell me a whole lot.

Here's how my initialization looks now:

sCOMPtr<nsIComponentRegistrar> registrar;
rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
if (NS_FAILED(rv)){
    return rv;
}
rv = registrar->AutoRegister(nsnull);

nsCOMPtr<nsILocalFile> binDir;
NS_NewNativeLocalFile(nsCString("C:\\Mozilla\\mozilla\\mozilla\\dist\\bin"), 
TRUE, getter_AddRefs(binDir));
rv = NS_InitEmbedding(binDir, nsnull);
if(NS_FAILED(rv)){
    return E_FAIL;
}

"Benjamin Smedberg" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Richard wrote:
>
>> So I finally had the NS_InitEmbedding working, however I had to do the 
>> following :
>> rv = NS_InitEmbedding(binDir, nsnull);
>> f(NS_FAILED(rv))
>> {
>>     rv = NS_InitEmbedding(binDir, nsnull);
>>     if(NS_FAILED(rv))
>>     {
>>         return FALSE;
>>     }
>> }
>>
>> THe first call always seemed to fail, but the second one works,
>
> This is because NS_InitEmbedding does reentrancy checks; you need to fix 
> the first failure.
>
>> However when I include that code in my project I get linker errors trying 
>> to find NS_GetComponentRegistrar. Any ideas?
>> currentyly I'm linking in :
>> embed_base_s.lib
>> nspr4.lib
>> profdirserviceprovider_s.lib
>> xpcomglue.lib
>> plc4.lib
>> plds4.lib
>
> You are linking xpcomglue.lib, but not defining XPCOM_GLUE. That will 
> definitely cause problems.
>
> Also, since you are using the standalone glue, you will need to call 
> XPCOMGlueStartup() before using any XPCOM functions (they are loaded 
> dynamically). Finally, it makes little sense to link against the 
> standalone glue *and* against NSPR: if you're going to depend on mozilla 
> libs, you might as well use the dependent glue (link xpcomglue_s.lib and 
> xpcom.lib, don't define XPCOM_GLUE, and you don't need to call 
> XPCOMGlueStartup()).
>
>> and have my preprocessor set to
>> XP_WIN32
>> XP_WIN
>
> Please ensure that you're including xpcom-config.h, instead of specifying 
> only these defines.
>
> --BDS
> 


_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to