swapnil wrote:
hi
I am using mozilla 1.7.13 source on redhat.
I am having a wierd problem. The NS_InitEmbedding fails if I even
instantiate anything after it.
If I comment out that line, it succeeds.  I stripped down my program to
the smallest code which reproduces the problem, see below. If you see
anything wrong or just completely incorrect, please suggest.
TIA

#include <stdio.h>
#include "nsISupports.h"
#include "nsEmbedAPI.h"
#include "nsIWebBrowser.h"

int main (int argc, char* const * argv)
{
 nsresult rv;
 rv = NS_InitEmbedding(nsnull, nsnull);
 if(NS_FAILED(rv))
 {
  printf("NS_InitEmbedding Failed. Returns [%x].\n", rv);
  return -1;
 }
 printf("NS_InitEmbedding Succeeded. Returns [%x].\n", rv);
 rv = NS_OK;
 //nsCOMPtr<nsIWebBrowser> mWebBrowser; // <-- THIS LINE
  return 0;
}
// Compile line is below
c++ -g -Wall -Wno-non-virtual-dtor -o test main.cpp  -DXPCOM_GLUE -I
../../mozilla/dist/sdk/include -I ../../mozilla/dist/include/xpcom/
-L/../../mozilla/dist/sdk/lib -lxpcomglue -lnspr4 -lplds4
-lembed_base_s -fno-rtti -fno-exceptions  -L../..//mozilla/dist/sdk/bin
-lxpcom


I'm not extremely familiar with Linux, but...when you call NS_InitEmbedding () you used nsnull...I would guess then that you have your libs (.so modules on linux?) in the same directory as your project? You have to be sure that if you pass nsnull to NS_InitEmbedding () all required modules are there in the .exe directory. Otherwise you need to create an nsIFile to point to where your /mozilla/dist/bin is located. So, all that to say that possibly it is not registering everything properly. I'm no expert :) but that is the first thing that jumped out at me.

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

Reply via email to