Well what I meant by doesnt work is it would compile without any
errors.  but when I pulled up the test page thats using my plugin,  its
as if the plugin wasnt even installed. calls to it wouldnt work. etc.

however, for some unexplainable reason,  building with /MDd is working
now.    /MD does not work, it throws a bunch of errors such as:
Error   3       error LNK2005: _malloc already defined in
MSVCRT.lib(MSVCR80.dll) LIBCMTD.lib
Error   4       error LNK2005: _calloc already defined in
MSVCRT.lib(MSVCR80.dll) LIBCMTD.lib
Error   5       error LNK2005: __recalloc already defined in
MSVCRT.lib(MSVCR80.dll) LIBCMTD.lib
Error   6       error LNK2005: _free already defined in
MSVCRT.lib(MSVCR80.dll) LIBCMTD.lib

I guess I'll try and fix that when I get to it. If you gurus know the
problem to that, cool.   for now,  im using the /MDd. I'd like to just
get this working. This project is only a proof of concept.  I'm not
getting any errors at all with /MDd. but my notify observer call isnt
triggering my javascript. this is my c++ code:

    char* topic = "My Topic";
    PRUnichar* wstring = nsnull;
    nsISupports* context = nsnull;

    nsCOMPtr<nsIObserverService> observerService;
    observerService = do_GetService("@mozilla.org/observer-service;1");
    observerService->NotifyObservers (context, topic, wstring);

I can verify thats its working by attaching to the firefox process. the
code is getting run. I have a button on my test page that calls it.
the sample i was originally going from didn't set context to nsnull.
firefox was crashing saying I needed to set it to something.  nsnull
compiles, but its just not calling back to my javascript either.  I'm
kinda puzzled on what I need to pass in as context to get it to work.
assuming thats my issue.  the javascript side of it is pretty straight
forward:

var myObserver = { observe : function(subject, topic, data)  {
                                     if (topic == "myTopic") {
                                          // callback from C++ XPCOM
                                          alert("my topic happened in
the plugin!");
                                     }
                                  }
                              };

 // register the observer
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

var observerService =
Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
observerService.addObserver(myObserver, "myTopic", false);

I'm guessing my issue is I need to pass in a proper context pointer
instead of a null one.  Would anyone agree with that, or does anyone
notice any other blaring error.

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to