@@ -147,6 +147,33 @@ struct type_info {
147
147
# define PYBIND11_BUILD_TYPE " "
148
148
#endif
149
149
150
+ // / Let's assume that different compilers are ABI-incompatible.
151
+ #if defined(_MSC_VER)
152
+ # define PYBIND11_COMPILER_TYPE " _msvc"
153
+ #elif defined(__INTEL_COMPILER)
154
+ # define PYBIND11_COMPILER_TYPE " _icc"
155
+ #elif defined(__clang__)
156
+ # define PYBIND11_COMPILER_TYPE " _clang"
157
+ #elif defined(__PGI)
158
+ # define PYBIND11_COMPILER_TYPE " _pgi"
159
+ #elif defined(__MINGW32__)
160
+ # define PYBIND11_COMPILER_TYPE " _mingw"
161
+ #elif defined(__CYGWIN__)
162
+ # define PYBIND11_COMPILER_TYPE " _gcc_cygwin"
163
+ #elif defined(__GNUC__)
164
+ # define PYBIND11_COMPILER_TYPE " _gcc"
165
+ #else
166
+ # define PYBIND11_COMPILER_TYPE " _unknown"
167
+ #endif
168
+
169
+ #if defined(_LIBCPP_VERSION)
170
+ # define PYBIND11_STDLIB " _libcpp"
171
+ #elif defined(__GLIBCXX__) || defined(__GLIBCPP__)
172
+ # define PYBIND11_STDLIB " _libstdcpp"
173
+ #else
174
+ # define PYBIND11_STDLIB " "
175
+ #endif
176
+
150
177
// / On Linux/OSX, changes in __GXX_ABI_VERSION__ indicate ABI incompatibility.
151
178
#if defined(__GXX_ABI_VERSION)
152
179
# define PYBIND11_BUILD_ABI " _cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION)
@@ -161,10 +188,10 @@ struct type_info {
161
188
#endif
162
189
163
190
#define PYBIND11_INTERNALS_ID " __pybind11_internals_v" \
164
- PYBIND11_TOSTRING (PYBIND11_INTERNALS_VERSION) PYBIND11_INTERNALS_KIND PYBIND11_BUILD_ABI PYBIND11_BUILD_TYPE "__"
191
+ PYBIND11_TOSTRING (PYBIND11_INTERNALS_VERSION) PYBIND11_INTERNALS_KIND PYBIND11_COMPILER_TYPE PYBIND11_STDLIB PYBIND11_BUILD_ABI PYBIND11_BUILD_TYPE "__"
165
192
166
193
#define PYBIND11_MODULE_LOCAL_ID " __pybind11_module_local_v" \
167
- PYBIND11_TOSTRING (PYBIND11_INTERNALS_VERSION) PYBIND11_INTERNALS_KIND PYBIND11_BUILD_ABI PYBIND11_BUILD_TYPE "__"
194
+ PYBIND11_TOSTRING (PYBIND11_INTERNALS_VERSION) PYBIND11_INTERNALS_KIND PYBIND11_COMPILER_TYPE PYBIND11_STDLIB PYBIND11_BUILD_ABI PYBIND11_BUILD_TYPE "__"
168
195
169
196
// / Each module locally stores a pointer to the `internals` data. The data
170
197
// / itself is shared among modules with the same `PYBIND11_INTERNALS_ID`.
0 commit comments