I need to build a C++ XPCOM component. Javascript will talk to this
component. I got this to work. However, I have to pass an object back
and forth.
The question is how do I do this?
I guess, using another component? So I go and create another one in a
same idl file, and generate both the header and type lib file. When
implement the stuff, I got an error while try to create the factory:
NS_IMPL_NSGETMODULE("MyCompnentModule", components_1)
NS_IMPL_NSGETMODULE("MyObjModule", components_2)
The error is because I call the above twice. So, I think I have to
call them once, but then how?
My overall question would be what is the right way of doing this in the
first place. Creating 2 components like this seems to be a daunting
task for just passing a simple object around. Thinking if I have a big
app, and every single class has to be like this, I wonder if this is
the right way at all. Please note that you can say change the method
call to not use the object, but this does not seem to be the option for
me unless there's no other solution.
An example of the IDL would be (just an example, not my real stuff):
#include "nsISupports.idl"
interface IMyObj;
[scriptable, uuid(xxxxxxxxxxxxxxxxxxxxxxxxxxx)]
interface IMyComponent: nsISupports{
void addObject(in IMyObj obj);
void getObject(in ACString name, out IMyObj obj);
//remove object, etc.
};
[scriptable, uuid(xxxxxxxxxxxxxxxxxxxxxxxxxxx)]
interface IMyObj : nsISupports{
attribute string name;
attribute string value;
}
Thank you very much for any help.
_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom