Ok. After some investigations it looks like regxpcom needs a components
directory where i am guessing the implementation of my interfaces are
located. Bear with me i am new to this. FYI my app runs from a standalone
directory that has nothing to do with mozilla and it's directory structure.
I was thinking that just linking through xpcom will do it but apparently it
does not. I copied xpcom.dll , gkgfxwin.dll, mozreg.dll, xpcom.dll  to my
debug dir (that is where my scribble.exe binary is located) and created an
empty dir called components under it. Am i supposed to have another dll that
you know about based on the source below ? I was let to beleive (from the
code) that eventloop was implemented inside xpcom.dll . I am wondering what
components/evntloop.dll is implementing and why is the call to
GetService(kEventQueueServiceCID, even working ! Please take the time and
fill me in here ! If the code is too old can someone please take the time to
do a sample app like scrbble .. it will only take a lunch session ...

JohnSmith wrote in message <8vviqk$[EMAIL PROTECTED]>...
>Hi.
>
>I am trying to instantiate an object and for the life of me i am not able
to
>do so. The code i have was copied verbatin from the widget/tests/scribble
>application. It must be something stupid i am doing  but I know this has to
>do with registration so bear with me. Before i forget i am using straight
>m18 build on an NT4sp3/VC60 . Here is the code
>
>    // register event queue classes
>    static NS_DEFINE_IID(kEventQueueCID, NS_EVENTQUEUE_CID);
>    static NS_DEFINE_IID(kIEventQueueServiceIID,
NS_IEVENTQUEUESERVICE_IID);
>    static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
>
>    nsComponentManager::RegisterComponentLib(kEventQueueCID, NULL, NULL,
>XPCOM_DLL, PR_FALSE, PR_FALSE);
>    nsComponentManager::RegisterComponentLib(kEventQueueServiceCID, NULL,
>NULL, XPCOM_DLL, PR_FALSE, PR_FALSE);
>
>    // register appshell classes
>    static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID);
>    static NS_DEFINE_IID(kCAppShellCID, NS_APPSHELL_CID);
>    nsComponentManager::RegisterComponentLib(kCAppShellCID, NULL, NULL,
>WIDGET_DLL, PR_FALSE, PR_FALSE);
>
>    // register graphics classes
>    static NS_DEFINE_IID(kCDeviceContextCID, NS_DEVICE_CONTEXT_CID);
>    static NS_DEFINE_IID(kIDeviceContextIID, NS_IDEVICE_CONTEXT_IID);
>
>    nsComponentManager::RegisterComponentLib(kCDeviceContextCID, NULL,
NULL,
>GFXWIN_DLL, PR_FALSE, PR_FALSE);
>
>    nsresult  res;
>
>    // Create the Event Queue for the UI thread...
>    res = nsServiceManager::GetService(kEventQueueServiceCID,
>                                       kIEventQueueServiceIID,
>                                       (nsISupports
>**)&scribbleData.mEventQService);
>
>    if (NS_OK != res) {
>        NS_ASSERTION(PR_FALSE, "Could not obtain the event queue service");
>        return res;
>    }
>
>    printf("Going to create the event queue\n");
>    res = scribbleData.mEventQService->CreateThreadEventQueue();
>    if (NS_OK != res) {
>        NS_ASSERTION(PR_FALSE, "Could not create the event queue for the
>thread");
> return res;
>    }
>
>     // Create an application shell
>    nsIAppShell *appShell = nsnull;
>    nsComponentManager::CreateInstance(kCAppShellCID, nsnull,
kIAppShellIID,
>                                 (void**)&appShell);
>    appShell->Create(argc, argv);
>
>    res = nsComponentManager::CreateInstance(kCDeviceContextCID, nsnull,
>kIDeviceContextIID, (void **)&scribbleData.mContext);
>
>    if (NS_OK != res)
>  return res;
>
>The code works until it reachs
>nsComponentManager::CreateInstance(kCDeviceContextCID,. At that point there
>is an assertion raised. Here is the stack:
>
>NTDLL! 77f76148()
>nsDebug::Assertion(const char * 0x100da79c, const char * 0x100da788, const
>char * 0x100da738, int 157) line 256 + 13 bytes
>nsDebug::WarnIfFalse(const char * 0x100da79c, const char * 0x100da788,
const
>char * 0x100da738, int 157) line 358 + 21 bytes
>nsNativeComponentLoader::GetFactory(nsNativeComponentLoader * const
>0x009d6c60, const nsID & {...}, const char * 0x009df2d0, const char *
>0x009df310, nsIFactory * * 0x0012fa84) line 157 + 37 bytes
>nsFactoryEntry::GetFactory(nsIFactory * * 0x0012fa84,
nsComponentManagerImpl
>* 0x009d4590) line 217 + 58 bytes
>nsComponentManagerImpl::FindFactory(nsComponentManagerImpl * const
>0x009d4590, const nsID & {...}, nsIFactory * * 0x0012fa84) line 1031
>nsComponentManagerImpl::CreateInstance(nsComponentManagerImpl * const
>0x009d4590, const nsID & {...}, nsISupports * 0x00000000, const nsID &
>{...}, void * * 0x0012fae8) line 1198 + 20 bytes
>nsComponentManager::CreateInstance(const nsID & {...}, nsISupports *
>0x00000000, const nsID & {...}, void * * 0x0012fae8) line 82
>nsServiceManagerImpl::GetService(nsServiceManagerImpl * const 0x009d3030,
>const nsID & {...}, const nsID & {...}, nsISupports * * 0x0012fb78,
>nsIShutdownListener * 0x00000000) line 344 + 19 bytes
>nsServiceManager::GetService(const nsID & {...}, const nsID & {...},
>nsISupports * * 0x0012fb78, nsIShutdownListener * 0x00000000) line 560
>nsGetServiceByCID::operator()(const nsID & {...}, void * * 0x0012fb78) line
>44 + 22 bytes
>nsCOMPtr<nsIPref>::assign_from_helper(const nsCOMPtr_helper & {...}, const
>nsID & {...}) line 856 + 18 bytes
>nsCOMPtr<nsIPref>::nsCOMPtr<nsIPref>(const nsCOMPtr_helper & {...}) line
553
>nsDeviceContextWin::nsDeviceContextWin() line 61 + 30 bytes
>nsGfxFactoryWin::CreateInstance(nsGfxFactoryWin * const 0x009e00c0,
>nsISupports * 0x00000000, const nsID & {...}, void * * 0x0041b68c) line 150
>+ 30 bytes
>nsComponentManagerImpl::CreateInstance(nsComponentManagerImpl * const
>0x009d4590, const nsID & {...}, nsISupports * 0x00000000, const nsID &
>{...}, void * * 0x0041b68c) line 1201 + 24 bytes
>nsComponentManager::CreateInstance(const nsID & {...}, nsISupports *
>0x00000000, const nsID & {...}, void * * 0x0041b68c) line 82
>CreateApplication(int * 0x0012fecc, char * * 0x009d3260) line 149 + 25
bytes
>main(int 1, char * * 0x009d3260) line 8 + 13 bytes
>WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00400000, char *
>0x00141e68, HINSTANCE__ * 0x00400000) line 105 + 41 bytes
>WinMainCRTStartup() line 330 + 54 bytes
>
>If you take a close look at
>nsNativeComponentLoader::GetFactory(nsNativeComponentLoader * const
>0x009d6c60, const nsID & {...}, const char * 0x009df2d0, const char *
>0x009df310, nsIFactory * * 0x0012fa84) line 157 + 37 bytes
>
>you will see the comment :
>
>    // If the dll failed to get us a factory. But the dll registered that
>    // it would be able to create a factory for this CID. mmh!
>    // We cannot just delete the dll as the dll could be hosting
>    // other CID for which factory creation can pass.
>    // We will just let it be. The effect will be next time we try
>    // creating the object, we will query the dll again. Since the
>    // dll is loaded, this aint a big hit. So for optimized builds
>    // this is ok to limp along.
>    NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Factory creation failed");
>
>
>If you have a way of registering all the components also please do tell me.
>I called nsAutoregister (with the same bin dir) to no avail. I am about to
>go and learn more about regxpcom.
>
>
>
>



Reply via email to