Olenhouse, Jason wrote:
Ben Hutchings wrote:
Olenhouse, Jason wrote:
I'm trying to pass a member function pointer around to the Windows Service Control Manager through Windpws API functions, but I think I'm having troubles with the __stdcall convention.
<snip>
No, the problem is passing a member function pointer. A member function pointer is not type-compatible with a function pointer with the same parameter types, regardless of whether they have the same calling convention.
<snip>
But I used boost::bind to get a function pointer to hide the implicit this.
Sorry, I skimmed the code and must have misunderstood how you were constructing the service dispatch table.
I thought that the purpose of boost::bind was for that reason. It seems that the way I did it was nearly successful other than function::target<>() returns a __cdecl function pointer instead of an __stdcall one, as indicated by the error that MSVC returns. <snip>
You can't use boost::bind or boost::function to generate function pointers for bound functions. That would require run-time code generation. Their purpose is to create function objects suitable for use with function templates. Ben.