"Benjamin D. Smedberg" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Vijay wrote:
> > 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
Sorry i missed out my mozilla versions :
compiled source code mozilla version : 1.4.1
mozilla installed in my system : 1.5
Thank you very much. It works now. But I get a segmentation fault when
i try to start XPCOMGlueStartup by passing the
/usr/local/mozilla/libxpcom.so, but the same worked properly when i
try to load the shared library from my compiled mozilla source code's
lib directory. why that is so ?
Vijay.
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom