Details
-
Task
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
-
None
Description
We need some meta-macro to put on {{extern template class}}es that get {{Q_FOO_EXPORT}}ed. Windows differs a bit here, in the sense that it expects the export macros in different locations than Linux and OSX.
I've read the corresponding chromium implementation, so I'm tainted, and can't implement one for Qt, someone else has to do it. Here's the spec:
Provide macros Q_DECLARE_EXTERN_TEMPLATE(X) and Q_DEFINE_EXTERN_TEMPLATE(X) where X is an export macro such as Q_CORE_EXPORT and Q_DECLARE_EXTERN_TEMPLATE is being used in the header:
extern template class Q_DECLARE_EXTERN_TEMPLATE(Q_CORE_EXPORT) QList<QString>;
while Q_DEFINE_EXTERN_TEMPLATE is used in the .cpp file:
template class Q_DEFINE_EXTERN_TEMPLATE(Q_CORE_EXPORT) QList<QString>;
On Windows, when building the QtCore library, these should expand to
extern template class QList<QString>; template class Q_CORE_EXPORT QList<QString>;
In all other cases to
extern template class Q_CORE_EXPORT QList<QString>; template class QList<QString>;
(that includes Windows when using the library).
We have something like that for QMetaType (macro QT_METATYPE_TEMPLATE_EXPORT), but for some reason it doesn't have the template class Q_CORE_EXPORT QMetaTypeForType<Name>; on Windows when building QtCore.
Acceptance criteria:
QT_METATYPE_TEMPLATE_EXPORT replaced with the new macros and working.
Attachments
Issue Links
- blocks
-
QTBUG-98555 Experiment with {{extern template class}}'ing common QtCore templates
- Reported