I have native dll project which I use from C# via CLI wrapper. In Initialize
method of dll i'm calling
WSAStartup(MAKEWORD(2, 2), &data);
This works fine. Now I"ve decided to move entire dll to boost::asio (because I will port it to Linux and I want to enable /Za compiler option).
The question is - where and how should I replace WSAStartup
call?
- move it to CLI wrapper or to the top-level C# project?
- replace it with some boost::asio call (which method to call?)
Boost.Asio
initialisesWinsock
beforemain()
- it uses a static object for this purpose. Here is an excerpt fromwinsock_init.hpp
:So, in your case
Winsock
will get initialised on dll load.(That's said, I'm afraid you can't compile
Asio
under Windows with/Za
, but you also don't have to do this in order to make your code portable to Linux.)