[zeromq-dev] Compiling zmq inside program
Mikko Koppanen
mikko at kuut.io
Wed Jan 11 14:09:45 CET 2012
On Wed, Jan 11, 2012 at 5:30 AM, Martin Sustrik <sustrik at 250bpm.com> wrote:
>> c) To be able to compile in windows I need to change manually zmq.h
>> and zmq_utils.h from: # if defined DLL_EXPORT # define
>> ZMQ_EXPORT __declspec(dllexport) # else # define ZMQ_EXPORT
>> __declspec(dllimport) # endif to: # if defined DLL_EXPORT #
>> define ZMQ_EXPORT # else # define ZMQ_EXPORT # endif I
>> would like to have one more define (NO_ZMQ_EXPORT?), is it too much
>> trouble to change this?
>
> What would such macro mean? What is a library good for it doesn't export
> any symbols?
Hi,
as far as I know the __declspecs are used to export/import symbols in
the DLL. At one point we decided against adding this to build as we
didn't expect there to be a lot of need for static libs on Windows. I
think something like this change would be needed:
diff --git a/include/zmq.h b/include/zmq.h
index 5dc1146..9b65526 100644
--- a/include/zmq.h
+++ b/include/zmq.h
@@ -35,7 +35,9 @@ extern "C" {
/* Handle DSO symbol visibility */
#if defined _WIN32
-# if defined DLL_EXPORT
+# if defined ZMQ_WIN_STATIC
+# define ZMQ_EXPORT
+# elif defined DLL_EXPORT
# define ZMQ_EXPORT __declspec(dllexport)
# else
# define ZMQ_EXPORT __declspec(dllimport)
and a new build configuration that defines ZMQ_WIN_STATIC and builds a
static library instead of DLL.
-- Mikko
More information about the zeromq-dev
mailing list