PRUnichar *u_url = URL.ToNewUnicode();
PRUnichar *u_url = ToNewUnicode(URL);
int main(int argc, char **argv) {	XtAppContext app;	gTopLevelWidget = XtAppInitialize( &app,                 // app context	                                   "embed_xlib_into_qt", // app class name																		 0,                    // option list																		 0,                    // number of options																		 &argc,                // argc																		 argv,                 // argv																		 0,                    // fallback resrces																		 0,                    // arg list																		 0 );                  // number of args	gDisplay = XtDisplay( gTopLevelWidget );	gScreenNumber = DefaultScreen( gDisplay );	printf("TOP LEVEL WIDGET: %p\n", gTopLevelWidget);  // init xlibrgb  xlib_rgb_init( gDisplay, DefaultScreenOfDisplay( gDisplay ) );  XtVaSetValues( gTopLevelWidget,								 XtNwidth,  500,								 XtNheight, 500,								 NULL);	printf("realizing TOP LEVEL WIDGET...\n");	XtRealizeWidget( gTopLevelWidget );	printf("done.\n");	gTopLevelWindow = XtWindow( gTopLevelWidget );	printf("Top Level Window = %ld\n", gTopLevelWindow);	  //////////////////////////////////////////////////////////////////////  //  // Toolkit Service setup  //   // Note: This must happend before NS_SetupRegistry() is called so  //       that the toolkit specific xpcom components can be registered  //       as needed.  //  //////////////////////////////////////////////////////////////////////  nsresult   rv;  nsIUnixToolkitService * unixToolkitService = nsnull;      rv = nsComponentManager::CreateInstance(kCUnixToolkitServiceCID,                                          nsnull,                                          NS_GET_IID(nsIUnixToolkitService),                                          (void **) &unixToolkitService);    NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot obtain unix toolkit service.");	if (!NS_SUCCEEDED(rv))		return 1;  // Force the toolkit into "xlib" mode regardless of MOZ_TOOLKIT  unixToolkitService->SetToolkitName("xlib");  NS_RELEASE(unixToolkitService);  //////////////////////////////////////////////////////////////////////  // End toolkit service setup  //////////////////////////////////////////////////////////////////////  //////////////////////////////////////////////////////////////////////  //  // Setup the registry  //  //////////////////////////////////////////////////////////////////////  NS_SetupRegistry();  printf("Creating event queue.\n");      nsIEventQueueService * eventQueueService = nsnull;  nsIEventQueue * eventQueue = nsnull;    // Create the Event Queue for the UI thread...    rv = nsServiceManager::GetService(kEventQueueServiceCID,									kIEventQueueServiceIID,									(nsISupports **)&eventQueueService);    NS_ASSERTION(NS_SUCCEEDED(rv),"Could not obtain the event queue service.");	if (!NS_SUCCEEDED(rv))		return 1;  rv = eventQueueService->CreateThreadEventQueue();    NS_ASSERTION(NS_SUCCEEDED(rv),"Could not create the event queue for the the thread.");  	if (!NS_SUCCEEDED(rv))		return 1;    rv = eventQueueService->GetThreadEventQueue(NS_CURRENT_THREAD, 	                                            &eventQueue);    NS_ASSERTION(NS_SUCCEEDED(rv),"Could not get the newly created thread event queue.\n");  	if (!NS_SUCCEEDED(rv))		return 1;    NS_RELEASE(eventQueueService);    rv = nsServiceManager::GetService(kWindowServiceCID,				    kWindowServiceIID,				    (nsISupports **)&gsWindowService);  NS_ASSERTION(NS_SUCCEEDED(rv),"Couldn't obtain window service\n");  if (!NS_SUCCEEDED(rv))		return 1;  gsWindowService->SetWindowCreateCallback(WindowCreateCallback);  gsWindowService->SetWindowDestroyCallback(WindowDestroyCallback);	// XXX Milind:	XtAppAddInput( app,	               eventQueue->GetEventQueueSelectFD(),								 ( XtInputId* )XtInputReadMask,								 event_processor_callback,								 eventQueue );  rv = nsRepository::CreateInstance(kWebShellCID, 	                                  nsnull, 																		kIWebShellIID, 																		(void**)&sgWebShell);  NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot create WebShell.\n");	if (!NS_SUCCEEDED(rv))		return 1;  sgWebShell->Init( ( nsNativeWidget )gTopLevelWindow, 0, 0, 500, 500);	gsWindowService->GetEventDispatcher(&gsEventDispatcher);  rv = nsComponentManager::CreateInstance(kPrefCID, 	                                        NULL, 																					kIPrefIID,					                                (void **) &sgPrefs);  if (NS_OK != rv) {    printf("failed to get prefs instance\n");    return rv;  }    sgPrefs->StartUp();  sgPrefs->ReadUserPrefs();  sgWebShell->SetPrefs(sgPrefs);	printf("showing webshell...\n");  sgWebShell->Show();  char *url = "http://www.mozilla.org/unix/xlib.html";  nsString URL(url);  PRUnichar *u_url = URL.ToNewUnicode();  sgWebShell->LoadURL(u_url);	XtPopup( gTopLevelWidget, XtGrabNone );	XtAddEventHandler( gTopLevelWidget,										 StructureNotifyMask,										 False,										 resize_callback,										 sgWebShell );  	XtAppMainLoop( app );}