Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-98556

Need export macro wrangling for exporting {{extern template class}}

    XMLWordPrintable

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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              mmutz Marc Mutz
              mmutz Marc Mutz
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes