Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-12-29 10:21:48


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").


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk