Uploaded image for project: 'Qpid Proton'
  1. Qpid Proton
  2. PROTON-68

Porting Issue -- dll imports and exports on Visual Studio

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.4
    • Component/s: proton-c
    • Labels:
    • Environment:
      Windows using Visual Studio 2010

      Description

      Visual Studio dlls use a macro to explicitly state which functions will be exported. I don’t have a list of all the functions that will be exported, so I just made the ones used by proton.c to be exportable. That left a lot that would be internal to the dll only. Then when I was working with the python, I realized that python was going to be importing a lot of functions from the dll that should never be exported unless testing, so I defined another macro for the python (ruby, etc) exported functions. Swig also had to be taken into account.

      This is what I’m using right now and it should work on the Linux/Unix platform:

      #ifdef SWIGWIN
      #define QPID_PROTON_API
      #else
      #ifdef _WINDOWS
      #ifdef qpid_proton_EXPORTS
      #define QPID_PROTON_API __declspec(dllexport)
      #ifdef qpid_proton_python_EXPORTS
      #define QPID_PROTON_PY __declspec(dllexport)
      #else
      #define QPID_PROTON_PY
      #endif
      #else
      #define QPID_PROTON_API __declspec(dllimport)
      #ifdef qpid_proton_python_IMPORTS
      #define QPID_PROTON_PY __declspec(dllimport)
      #else
      #define QPID_PROTON_PY
      #endif
      #endif
      #else
      #define QPID_PROTON_API
      #endif
      #endif

      That means all the headers will need to be changed to include the macros.
      e.g.
      QPID_PROTON_API pn_data_t *pn_data(size_t capacity);
      QPID_PROTON_API void pn_data_free(pn_data_t *data);
      QPID_PROTON_PY int pn_data_errno(pn_data_t *data);

        Attachments

          Activity

            People

            • Assignee:
              cliffjansen Cliff Jansen
              Reporter:
              marydhinton Mary hinton
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: