summaryrefslogtreecommitdiff
path: root/src/nng.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-13 00:00:47 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-13 00:00:47 -0800
commitb639e4d3643b8245b77bc8707a3a864221fad195 (patch)
treeaa21c05f7ce8a1fd388b1eb1189e38e66f79e068 /src/nng.h
parent2bb6a23037656474a90d869c5147b32bae1a2e40 (diff)
downloadnng-b639e4d3643b8245b77bc8707a3a864221fad195.tar.gz
nng-b639e4d3643b8245b77bc8707a3a864221fad195.tar.bz2
nng-b639e4d3643b8245b77bc8707a3a864221fad195.zip
Many fixes for Windows. It compiles, and some tests work.
Windows is getting there. Needs a couple of more more hours to enable everything, especially IPC, and most of the work at this point is probably some combination of debug and tweaking things like error handling.
Diffstat (limited to 'src/nng.h')
-rw-r--r--src/nng.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/nng.h b/src/nng.h
index 932c9a59..bf7bfa7b 100644
--- a/src/nng.h
+++ b/src/nng.h
@@ -30,8 +30,16 @@ extern "C" {
// as a DLL, but instead linking it statically for your projects
// to minimize questions about link dependencies later.)
#ifndef NNG_DECL
-#define NNG_DECL extern
-#endif
+#if defined(_WIN32) && !defined(NNG_STATIC_LIB)
+#if defined(NNG_SHARED_LIB)
+#define NNG_DECL __declspec(dllexport)
+#else
+#define NNG_DECL __declspec(dllimport)
+#endif // NNG_SHARED_LIB
+#else
+#define NNG_DECL extern
+#endif // _WIN32 && !NNG_STATIC_LIB
+#endif // NNG_DECL
// Types common to nng.
typedef struct nng_socket nng_socket;
@@ -64,10 +72,10 @@ NNG_DECL void nng_close(nng_socket *);
NNG_DECL int nng_shutdown(nng_socket *);
// nng_protocol returns the protocol number of the socket.
-uint16_t nng_protocol(nng_socket *);
+NNG_DECL uint16_t nng_protocol(nng_socket *);
// nng_peer returns the protocol number for the socket's peer.
-uint16_t nng_peer(nng_socket *);
+NNG_DECL uint16_t nng_peer(nng_socket *);
// nng_setopt sets an option for a specific socket.
NNG_DECL int nng_setopt(nng_socket *, int, const void *, size_t);