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

Porting Issue -- dll imports and exports on Visual Studio


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


      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
      #ifdef _WINDOWS
      #ifdef qpid_proton_EXPORTS
      #define QPID_PROTON_API __declspec(dllexport)
      #ifdef qpid_proton_python_EXPORTS
      #define QPID_PROTON_PY __declspec(dllexport)
      #define QPID_PROTON_PY
      #define QPID_PROTON_API __declspec(dllimport)
      #ifdef qpid_proton_python_IMPORTS
      #define QPID_PROTON_PY __declspec(dllimport)
      #define QPID_PROTON_PY
      #define QPID_PROTON_API

      That means all the headers will need to be changed to include the macros.
      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);




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


              • Created: