[asio] WSASend needs reinterpret_cast<WSAOVERLAPPED*>.

Hi Christopher, The VC7.1 complains that win_iocp_operation cant be converted to WSAOVERLAPPED when tried to pass it to WSASend. I inserted this on win_iocp_socket_service.hpp:526 - &bytes_transferred, flags, ptr.get(), 0); +&bytes_transferred, flags, reinterpret_cast<LPWSAOVERLAPPED>(static_cast<LPOVERLAPPED>(ptr.get())), 0); And it worked here. -- Felipe Magno de Almeida

Hi Felipe, Felipe Magno de Almeida <felipe.m.almeida@gmail.com> wrote:
The VC7.1 complains that win_iocp_operation cant be converted to WSAOVERLAPPED when tried to pass it to WSASend. I inserted this on win_iocp_socket_service.hpp:526
- &bytes_transferred, flags, ptr.get(), 0); +&bytes_transferred, flags, reinterpret_cast<LPWSAOVERLAPPED>(static_cast<LPOVERLAPPED>(ptr.get())), 0);
And it worked here.
Actually the problem is a missing define for WIN32. Newer Platform SDKs (like the one I use) automatically #define WIN32 for you in WinDef.h, but the one shipped with VC7.1 does not. If WIN32 is not defined, Winsock2.h assumes you are compiling for 16-bit Windows (!) and redefines the WSAOVERLAPPED structure instead of just making it a typedef for OVERLAPPED. You can work around the problem by adding the WIN32 definition to your makefile/Jamfile/project settings. I have made a change to asio/detail/socket_types.hpp in asio's CVS repository to automatically define it, and will merge the change over to Boost CVS soon. Cheers, Chris
participants (2)
-
Christopher Kohlhoff
-
Felipe Magno de Almeida