[zeromq-dev] Statically compiling libzmq on Windows
Stefan Radomski
radomski at tk.informatik.tu-darmstadt.de
Tue Dec 4 15:36:26 CET 2012
Hi again,
we are compiling static binaries of zeromq and link them into our executables. On windows, that means that I always open up zmq.h and zmq_utils.h to edit the part with regard to DSO symbol visibility as follows:
#ifndef ZMQ_STATIC
#if defined _WIN32
# if defined DLL_EXPORT
# define ZMQ_EXPORT __declspec(dllexport)
# else
# define ZMQ_EXPORT __declspec(dllimport)
# endif
#else
# if defined __SUNPRO_C || defined __SUNPRO_CC
# define ZMQ_EXPORT __global
# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER
# define ZMQ_EXPORT __attribute__ ((visibility("default")))
# else
# define ZMQ_EXPORT
# endif
#endif
#else
#define ZMQ_EXPORT
#endif
then adapt the build type in the Visual Studio project and pass ZMQ_STATIC as a preprocessor flag. The issue popped up on this list earlier as well [1][2]. The question is, whether you'd want the ZMQ_STATIC handling contributed to the master branch or is there another supported approach I missed? I cannot see how to make a test-case for this one though.
Regards
Stefan
[1] http://lists.zeromq.org/pipermail/zeromq-dev/2011-September/013150.html
[2] http://grokbase.com/t/zeromq/zeromq-dev/1166bfmzt6/how-to-make-it-easier-to-compile-static-lib-under-windows-dll-export-in-zmq-h
More information about the zeromq-dev
mailing list