clsocket icon indicating copy to clipboard operation
clsocket copied to clipboard

EXPORT definition might collide easily

Open hayguen opened this issue 4 years ago • 3 comments

#define EXPORT __declspec(dllexport)

is defined in Host.h include from other public headers (SimpleSocket.h), with guard #ifdef _MSC_VER. however this definition might collide easily with user code using CLsocket.

i'd suggest to rename EXPORT into CLSOCKET_EXPORT .. [ and possibly make this definition only when having an additional private definition in CMakeLists.txt, e.g. when compiling the shared library ]

hayguen avatar Aug 12 '20 14:08 hayguen

Sounds good to me - probably something I should have thought about in #17

lethosor avatar Aug 12 '20 15:08 lethosor

now have also a commit for this issue in PR https://github.com/DFHack/clsocket/pull/4 might need some more testing on Windows - but it got late for today.

different from my own suggestion i renamed EXPORT to CLSOCKET_API, and also added dllimport .. and activate that only when compiling the shared library.

hayguen avatar Aug 12 '20 21:08 hayguen

Looks awesome, thanks for the fix! Saves me from having to address https://github.com/DFHack/clsocket/pull/17#issuecomment-680125404. That was on my to-do list, so I'll take a closer look at #4, hopefully soon.

lethosor avatar Sep 09 '20 03:09 lethosor