Jon Smirl wrote:

> I'm looking at Transformiix and adding the ability to call external XPCOM
> functions. Transformiix can get a component ID and CreateInstance the
> component. Now I have a string for the method name and serveral parameters
> which may or may not match what the functions needs. Is there an easy way to
> call a method via a string based name from C++? Or do I have to write all of
> the code to read the typelib and build the call?


What exactly is the motivation for this, out of curiosity? I'm wondering 
if perhaps this could be moved to object-level and use contract IDs.. 
for instance:

nsCOMPtr<nsIFooInterface1> foo =
     do_CreateInstance("@mozilla.org/foo1;1");
if (foo)
   return foo->CallMethod(a,b,c);


nsCOMPtr<nsIFooInterface2> foo2 =
     do_CreateInstance("@mozilla.org/foo2;1");
   return foo2->CallOtherMethod(b,c,a);

However, if you're trying to do this to reduce dependencies, realize 
that you're adding a tremendous amount over per-call overhead just to 
prevent a minor build-time dependency that could be rearchitected, 
instead of hacked around.


Alec


Reply via email to