Mary hinton created PROTON-68:
---------------------------------

             Summary: Porting Issue -- dll imports and exports on Visual Studio
                 Key: PROTON-68
                 URL: https://issues.apache.org/jira/browse/PROTON-68
             Project: Qpid Proton
          Issue Type: Improvement
          Components: proton-c
         Environment: Windows using Visual Studio 2010 
            Reporter: Mary hinton


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);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to