Nitin wrote:
> How and where do I get these Netscape files?

The only way to get them is to build them yourself. You'll have to pull 
the source down from the cvs server, with the appropriate tag.

cvs co -r MOZILLA_1_0_BRANCH mozilla/client.mak

I'm not sure that's the branch tag you want, though. I don't remember 
off the top of my head what the tag is for 6.2.

What's most likely happening is that when you link against a DLL it uses 
the ordinals instead of the function names. More than like between 6.2 
and the mozilla lib's you have, those numbers have changed.


> 
>>Here's where you're going to run into problems. Currently the only real 
>>way to invoke a method is from C++. What you would need to do is provide 
>>a C wrapper around the XPTC_InvokeByIndex function and nsXPTCVariant. 
>>Once this is done, you can then manually invoke AddRef and Release 
>>methods, to effect what nsCOMPtr is doing.
> 
> 
> Do you mean I can avoid the nsCOMPtr? 
> I have found that there exist a entry point for "XPTC_InvokeByIndex"
> function, but I am unable to use this, can you please give me a sample
> for this, I possible as I am really new for COM.

XPTC_InvokeByIndex is a C++ function so you won't be able to call it 
from C++. You'll have to create a extern "C" function that you export 
from a private DLL of your creation and call that. Since you're going to 
have to do this for XPTC_InvokeByIndex, you might be better off adding 
your own wrapper for NS_InitXPCOM2.

Here's some very loose psuedo code of what you'll probably need to do

typedef struct
{
/* your variant union goes here
} MyVariant;

void ConvertFromMyVariant(
     MyVariant const & src,
     nsXPTCVariant & dest)
{
    // Code that converts the variant
}

extern "C" {
YOUR_DLL_EXPORT_MACRO unsigned long MY_InvokeByIndex(
     void * that,
     unsigned long index,
     unsigned long paramCount,
     MyVariant * params)
{
     nsXPTCVariant * paramBuffer = new nsXPTCVariant[paramCount];
     for (unsigned long i = 0; i < index; ++i)
     {
         ConvertFromMyVariant(
             params[i],
             paramBuffer[i]);
     }
     return XPTC_InvokeByIndex(
         reinterpret_cast<nsISupports*>that,
         index,
         paramCount,
         paramBuffer);
}

YOUR_DLL_EXPORT_MACRO void InitializeXPCOM()
{
     NS_InitXPCOM2(0, 0, 0);
}

}


Reply via email to