i'm attempting to wrap some API calls in a COM server so i can call it from the web, and i'm having some problems with a function pointer. one of the API calls that i'm making expects a "C-style" function pointer as an argument. the problem is that the callback function i want to use is now a member of my CoClass. so when i try to pass a pointer to the function i get this compiler error:
cannot convert from 'int (__thiscall CTask::*)(long,int,int,int,int,const char *)' to 'int (__cdecl *)(long,int,int,int,int,const char *)'
There is no context in which this conversion is possible
i tried some googling and came up with this: . i considered all 3 of the solutions listed. one does not work because unless i am mistaken, i cannot use static functions in my CoClass (am i wrong about that?). two and three do not work because i can't create a global instance of my CoClass.
i have tried various methods of casting my function pointer in an attempt to make this work. so far i've had no success. i'm beginning to wonder if this is even possible. can anyone tell me (1) if this is possible, and if so (2) how do i do it? any hints or suggestions will be greatly appreciated. thank you!
cannot convert from 'int (__thiscall CTask::*)(long,int,int,int,int,const char *)' to 'int (__cdecl *)(long,int,int,int,int,const char *)'
There is no context in which this conversion is possible
i tried some googling and came up with this: . i considered all 3 of the solutions listed. one does not work because unless i am mistaken, i cannot use static functions in my CoClass (am i wrong about that?). two and three do not work because i can't create a global instance of my CoClass.
i have tried various methods of casting my function pointer in an attempt to make this work. so far i've had no success. i'm beginning to wonder if this is even possible. can anyone tell me (1) if this is possible, and if so (2) how do i do it? any hints or suggestions will be greatly appreciated. thank you!