Skip to content

don't include winsock2.h in public headers#68

Open
ligfx wants to merge 1 commit into
lsalzman:masterfrom
ligfx:dont-leak-windows-headers
Open

don't include winsock2.h in public headers#68
ligfx wants to merge 1 commit into
lsalzman:masterfrom
ligfx:dont-leak-windows-headers

Conversation

@ligfx

@ligfx ligfx commented Jan 24, 2017

Copy link
Copy Markdown

Windows headers have a tendency to pollute the global namespace and can cause issues with code that's not expecting it. enet should be a friendly neighbor and not expose Windows headers to end-users :)

Windows headers have a tendency to pollute the global namespace and
can cause issues with code that's not expecting it. enet should be a
friendly neighbor and not expose Windows headers to end-users.
@ligfx ligfx force-pushed the dont-leak-windows-headers branch from 2e7062d to f9bc5a8 Compare January 24, 2017 22:04
@ligfx

ligfx commented Nov 2, 2017

Copy link
Copy Markdown
Author

@lsalzman Any thoughts on this?

@lsalzman

lsalzman commented Nov 3, 2017

Copy link
Copy Markdown
Owner

This won't work because the ENET_SOCKETSET_* and the ENET_HOST_TO_NET/ENET_NET_TO_HOST macros require winsock, and may be used as part of ENet's API.

@ligfx

ligfx commented Nov 4, 2017

Copy link
Copy Markdown
Author

Dang, I didn't see those. Would you be open to another solution like, forward-declaring the SOCKET/ENetSocket type in the types.h header?

My use-case is I want to keep Windows headers out of my code headers (so they don't propagate), but still be able to use ENet directly in member variables or for function arguments.

@lsalzman

lsalzman commented Nov 4, 2017

Copy link
Copy Markdown
Owner

I'll work something out with a define you can use before including to stop winsock.

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

Successfully merging this pull request may close these issues.

2 participants