I am using a c dll in a c++ class. One of the member functions should call the following function that generates an interrupt and calls a service routine:
signed short __stdcall SetIrqConditions
(
signed short DevNum,
unsigned short bEnable,
unsigned int dwIrqMask,
void (__stdcall * funcExternalIsr)
(
signed short DevNum,
unsigned int dwIrqStatus
)
);
I am trying to call another member function of the same class as the last parameter of this function.(funcExternalIsr) When I tried to do this, the compiler complained that the function is not static. So I defined the callee function as a static function, but when I do that I cannot access other members of the class.
class myClass
{
public:
int counter;
void func1();
static void __stdcall func2(signed short DevNum, unsigned int Status);
};
void myClass::func1()
{
...
Result = SetIrqConditions(DevNum, TRUE, Mask, func2); --> no error here once func2 is static
}
void myClass::func2(signed short DevNum, unsigned int Status)
{
counter++; --> invalid use of member 'counter' in static member function
}
I tried many different ways and did some research but I can't seem to get this working, any pointers in the right direction would be appreciated.