1. Revision History
1.1. Revision 0
Initial Release 🎉
Generalized attributes were added in C++11 and for a brief period there was hope that all compiler vendors would be able to do away with their custom implementation specific syntax for attributes. Instead, we are still stuck having to use preprocessor macros just so we can have dynamically linked libraries work under multiple compilers. While the standard doesn’t say anything about dynamically linked libraries, they do exist (whether we want them to or not). This paper does not seek to define this concept. It just makes a simple attribute required for all compiler vendors, especially those that have not placed their DLL export attribute into a namespace. One particular compiler vendor is extremely guilty of this. While the author doesn’t want to name and shame, they will state that the name of the vendor in question starts with the letter "M" and ends in "icrosoft".
This paper is extremely similar to, but not a recreation of, [P0276]. While that paper attempted to specify all the possible traits available for visibility in regards to a shared library, this paper focuses entirely on interfaces exported via shared libraries. Additionally, we go one step further and limit this "sharing" to functions only. There are many issues that can arise from sharing a type over program boundaries and this paper is avoiding them. A future paper can argue in favor of expanding what foundation this proposal lays down now.
Note: The author is more than willing to pull this paper if every vendor would just behave and promise to namespace their compiler specific attributes so we don’t have to go through something like this in the future.
is recommended as it involves sharing interfaces across
program boundaries. This differs from [P0276] which used GCC’s existing
name as a base. There is no intended "import" vs "export"
function declaration dichotomy. Platforms that might have required a difference
are no longer supported by their vendors, and have instead added support for a
Note: These same platforms may still require an "import" vs "export" for non-function entities.
Wording is relative to [N4762]
4.1. Feature Testing
Tests for the
attribute can be completed via the current convention of
Special thanks to Antony Polukhin, who did a majority of the heavy lifting last time a paper like this was brought before the committee.