nsresult res = factory->QueryInterface(kFactoryIID, (void **) aFactory);
nsresult res = factory->QueryInterface(NS_GET_IID(nsIFactory), (void **) aFactory);
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* aServMgr,                                           const nsCID &aClass,                                           const char *aClassName,                                           const char *aProgID,                                           nsIFactory **aFactory){  if (aFactory == NULL) {    return NS_ERROR_NULL_POINTER;  }  if (aClass.Equals(kTestLoadedFactoryCID)) {    TestDynamicFactory *factory = new TestDynamicFactory();    nsresult res = factory->QueryInterface(kFactoryIID, (void **) aFactory);    if (NS_FAILED(res)) {      *aFactory = NULL;      delete factory;    }    return res;  }  return NS_NOINTERFACE;}