Hi,
I m trying to start the XPCOM. I came across lot of problems which i
have listed it here :
1. The following code doesn't initialize XPCOM for me :
#include "nsXPCOM.h"
#include "nsCOMPtr.h"
#include "nsEmbedString.h"
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
nsresult result;
nsIServiceManager* serviceManager = NULL;
char *str = "/usr/local/mozilla";
nsEmbedString eStr((const PRUnichar *) str, strlen(str));
nsILocalFile *lFile = NULL;
NS_NewLocalFile(eStr, PR_FALSE, &lFile);
if (lFile == NULL)
{
printf("nsILocalFile is null\n");
}
else
{
printf("nsILocalFile is not nullllllllllll \n");
}
result = NS_InitXPCOM2(&serviceManager, (nsIFile *) lFile, nsnull);
if (result == NS_OK)
{
printf("yes init embedding done\n");
}
else {
printf("oh ! my goodness, how should i do that ?\n");
}
result = NS_ShutdownXPCOM(serviceManager);
}
If the code doesn't make sense at all, kindly educate me on this
front.
2. I had problems using libembed_base_s.a with XPCOM_GLUE. How to
resolve it ? This is the reason why i did not use NS_InitEmbedding or
NS_TermEmbedding() in my code.
3. The following code snippet throws a compilation error :
nsCOMPtr<nsIComponentRegistrar> registrar;
nsresult rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
if (NS_FAILURE(rv)) return rv;
rv = registrar->AutoRegister(nsnull);
The error is printed below :
Example.cc: In instantiation of `nsCOMPtr<nsIComponentRegistrar>':
Example.cc:15: instantiated from here
Example.cc:15: `sizeof' applied to incomplete type
`nsIComponentRegistrar'
Example.cc: In instantiation of
`nsDerivedSafe<nsIComponentRegistrar>':
Example.cc:18: instantiated from here
Example.cc:18: base class `nsIComponentRegistrar' has incomplete type
Example.cc: In function `int main(int, char**)':
Example.cc:18: no matching function for call to `
nsDerivedSafe<nsIComponentRegistrar>::AutoRegister(int)'
What could be the reason ?
I'm very new to this XPCOM / Gecko . Kindly help me in this regard.
Thanks,
Vijay.
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom