views:

50

answers:

1

I want to start thread in XPCOM Component. Here is a code for creating thread

nsresult rv = NS_OK;
    nsCOMPtr<Callback> obj = do_CreateInstance("@jscallback.p2psearch.com/f2f;1", &rv);
    NS_ENSURE_SUCCESS(rv, rv);
    char* str="Hello from C++";
    _beginthread( (void(*)(nsCOMPtr<Callback> ))&P2P::test, 0,obj);

    return NS_OK;//obj->Status(str);

Here is a function

#include "winsock2.h"
#include <process.h>
#include "nsCOMPtr.h"
#include "Callback.h"
class P2P{
public:
    void test(nsCOMPtr<Callback> obj){

}

};

I am getting error as

error C2440: 'type cast' : cannot convert from 'void (__thiscall P2P::* )(nsCOMPtr)' to 'void (__cdecl *)(nsCOMPtr)'

A: 

Make P2P::test static and add __cdecl calling convention.

Cristian Adam
.... lol :) ...thanks
Xinus