msgpack / msgpack-d

MessagePack for D / msgpack.org[D]
http://msgpack.org/
Boost Software License 1.0
118 stars 41 forks source link

Windows builds must link with Ws2_32.lib` #120

Open mdparker opened 3 years ago

mdparker commented 3 years ago

common.d imports core.sys.windows.winsock2, but the dub recipe does not require the winsock library, causing linker errors for missing ntohl and ntohs. Perhaps a pragma(lib, "Ws2_32") in the Windows version block at the top of common.d?

mdparker commented 3 years ago

Okay, I see there's already a pragma in package.d. However, when compiling the example from the readme on Windows, I did see those missing symbol errors and had to link the example with winsock.

kinke commented 2 years ago

We see linker errors too because of this. The pragma seems to be in the wrong module - if that package.d object file isn't pulled in (from the static lib), the embedded linker directive isn't used. I suggest moving it to dub.json, or better yet, getting rid of the manual endianness conversions (using ntohs and ntohl from winsock2) via std.bitmanip.nativeToBigEndian() etc.