API calling convention and pack
[Trac: Originally reported by jf_menard on 2007-09-07 04:33:35]
[Trac: Originally assigned to jf_menard]
Use a define for API calling convention. This is required if static-linked with another calling convention.
Declare a struct packing in public headers. Required to ensure consistent packing across projects (in VS2005).
We are reviewing this ticket on the mailing list. A summary of discussions is here:
http://www.portaudio.com/trac/wiki/StructPackingAndApiCallingConvention
[Trac: Originally assigned to jf_menard]
Use a define for API calling convention. This is required if static-linked with another calling convention.
Declare a struct packing in public headers. Required to ensure consistent packing across projects (in VS2005).
We are reviewing this ticket on the mailing list. A summary of discussions is here:
http://www.portaudio.com/trac/wiki/StructPackingAndApiCallingConvention
Leave a comment
I'm not sure the PA_API_CC macro format used here is sufficent to cover calling conventions on all platforms. I've seen other calling convention macros that take the return types as parameters. Also need to resolve how this interacts with doxygen.
The question is not so much with whether we need what this patch does -- it's whether this patch does it the best way for all platforms.
Should review other code bases for guidance. (python libs?)
The question is not so much with whether we need what this patch does -- it's whether this patch does it the best way for all platforms.
Should review other code bases for guidance. (python libs?)
Recent list discussion have identified the following issues and open questions (not sure this is exhaustive yet):
- how to wrap calling conventions? (need to accomodate {{{__declspec(import)}}} and calling convention). Python uses macros like PA_API_FUNC(RETURNTYPE) that can insert code before and after the return type.
- which calling convention to use on Windows? {{{__stdcall}}} is the defacto standard but we will need to explore name mangling issues.
- what amount of packing to use? (4 byte packing is standard for say VB, but we have 8-byte doubles in some structs so perhaps we want to combine manual padding and pragmas to give both 8 byte natural alignment and compatibility with 4 byte packing schemes)
- how to wrap calling conventions? (need to accomodate {{{__declspec(import)}}} and calling convention). Python uses macros like PA_API_FUNC(RETURNTYPE) that can insert code before and after the return type.
- which calling convention to use on Windows? {{{__stdcall}}} is the defacto standard but we will need to explore name mangling issues.
- what amount of packing to use? (4 byte packing is standard for say VB, but we have 8-byte doubles in some structs so perhaps we want to combine manual padding and pragmas to give both 8 byte natural alignment and compatibility with 4 byte packing schemes)
file:bFPVPssjOr4zieacwqjQWU
Ticket58.patch (26.8 KB) - added to Trac by jf_menard 4 years ago:
SVN patch for ticket #58
Ticket58.patch (26.8 KB) - added to Trac by jf_menard 4 years ago:
SVN patch for ticket #58