Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows builds must link with Ws2_32.lib` #120

Open
mdparker opened this issue Jul 16, 2021 · 2 comments
Open

Windows builds must link with Ws2_32.lib` #120

mdparker opened this issue Jul 16, 2021 · 2 comments

Comments

@mdparker
Copy link

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
Copy link
Author

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
Copy link

kinke commented Aug 9, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants