
29 Dec
2004
29 Dec
'04
3:21 p.m.
Dirk Gregorius wrote:
Thanks - the custom functor works, but I don't understand why using boost::bind or std::bind1 fails:
Does anybody know why the compiler complains about this?
typedef shared_ptr<void> handle; handle make_dc( HWND hWnd ) { handle spHandle( GetDC( hWnd ), bind( &ReleaseDC, hWnd, _1 ) ); return handle; }
The problem is that ReleaseDC uses the __stdcall calling convention: http://boost.org/libs/bind/bind.html#Q_win32_api #define BOOST_BIND_ENABLE_STDCALL to turn on __stdcall support (and change "return handle" to "return spHandle").