Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5982833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:08:37+00:00 2026-05-22T22:08:37+00:00

I have a project in visual c++ 2010, which contains preprocessor directives in a

  • 0

I have a project in visual c++ 2010, which contains preprocessor directives in a key header file. Actually, it is the ZMQ source code.

The project is normally configured to be a dll, so the header uses DLL_EXPORT’s status (defined/not defined). If the project is used to compile a dll, the header can be used by both the dll project or the client code, thanks to the following setup taken from zmq.h:

#if defined _WIN32
#   if defined DLL_EXPORT
#       define ZMQ_EXPORT __declspec(dllexport)
#   else
#       define ZMQ_EXPORT __declspec(dllimport)
#   endif

However, this does not support the setup where I’m building a static library. Therefore I have to modify to header by hand.
Visual studio seems to recognize dll project setup and handle definitions for dll_export accordingly. Is there a symbol that is recognized by visual studio, that corresponds to static library setup? Basically, I’d like to handle static library compilation and usage by extending the method used in the above snippet.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:08:38+00:00Added an answer on May 22, 2026 at 10:08 pm

    I would just introduce a second (optional) macro, something like ZMQ_STATIC:

    #if defined(ZMQ_STATIC)
    #    define ZMQ_EXPORT
    #elif defined(DLL_EXPORT)
    #    define ZMQ_EXPORT __declspec(dllexport)
    #else
    #    define ZMQ_EXPORT __declspec(dllimport)
    #endif
    

    Define said macro both when building your library as a static library or when consuming it as a static library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Visual Studio 2010 C++. I have a project which uses MFC and I
I have a Setup Project in Visual Studio 2010 which creates a .msi installer.
I have a Windows project in Visual Studio 2010 in which I store all
I have a VB6 project in Visual Source Safe 6.0. When I open the
Recently we started working with Database project in Visual Studio 2010. I have added
In visual studio 2010 I have setup a Project Visual Studio Installer it includes
I have a project which is coded with Visual Studio 2008. Today I migrated
I have database project in visual studio 2010. It has tables views stored procedures
I have a common problem with Visual Studio 2010 and my C++ project. Some
I am working on a project in Visual Studio 2010 which is to produce

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.