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));Are you linking against the XPCOM shared lib or using the xpcom glue? If you're using the glue, you need to call XPCOMGlueStartup before you use nsEmbedString or any of the other functions.
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);
You need to #include "nsIComponentRegistrar.h". You cannot use a comptr without including the appropriate header.
--BDS _______________________________________________ Mozilla-xpcom mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-xpcom
