Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Export all symbols from dlls on windows (including Qt metaobjects)
Forum Updated to NodeBB v4.3 + New Features

Export all symbols from dlls on windows (including Qt metaobjects)

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 969 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Creaperdown
    wrote on last edited by
    #1

    Hey, I am using Qt 6.5 and cmake and I am looking for a way to export all symbols from my dlls, without needing to manually add macros to them. I am aware that there is WINDOWS_EXPORT_ALL_SYMBOLS for cmake, but this doesn't seem to export metaobjects, thus giving me errors that tell me that linking those failed.
    Is there a solution to this that also links the Qt metaobjects?

    Thanks in advance.

    C 1 Reply Last reply
    0
    • C Creaperdown

      @Christian-Ehrlicher I am pretty sure that there is a limitation of WINDOWS_EXPORT_ALL_SYMBOLS, namely that it can not export static symbols. Do you know some way around that for Qt?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by Christian Ehrlicher
      #7

      Use proper export macros and/or create a cmake bug report.
      Using the correct macros will also help the compiler / optimizer and the link & loading speed on linux.

      /edit: See the documentation about static symbols - so no need to create a bug report.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • C Creaperdown

        Hey, I am using Qt 6.5 and cmake and I am looking for a way to export all symbols from my dlls, without needing to manually add macros to them. I am aware that there is WINDOWS_EXPORT_ALL_SYMBOLS for cmake, but this doesn't seem to export metaobjects, thus giving me errors that tell me that linking those failed.
        Is there a solution to this that also links the Qt metaobjects?

        Thanks in advance.

        C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #2

        @Creaperdown What problem are you trying to solve? I ask because this looks like an XY Problem.

        If you want the QMetaObject of any QObject object then just call object->metaobject().

        C 1 Reply Last reply
        0
        • C ChrisW67

          @Creaperdown What problem are you trying to solve? I ask because this looks like an XY Problem.

          If you want the QMetaObject of any QObject object then just call object->metaobject().

          C Offline
          C Offline
          Creaperdown
          wrote on last edited by
          #3

          @ChrisW67 My application is composed from multiple layers, separated as dlls. Dlls on linux automatically export their symbols, dlls on windows dont, so I would need to add export macros to all my classes and functions, which I'd like to avoid.
          My question is, if there is a way to, like WINDOWS_EXPORT_ALL_SYMBOLS to export all symbols by default. WINDOWS_EXPORT_ALL_SYMBOLS does not work for metaobjects, as mentioned in my post.

          Christian EhrlicherC 1 Reply Last reply
          0
          • C Creaperdown

            @ChrisW67 My application is composed from multiple layers, separated as dlls. Dlls on linux automatically export their symbols, dlls on windows dont, so I would need to add export macros to all my classes and functions, which I'd like to avoid.
            My question is, if there is a way to, like WINDOWS_EXPORT_ALL_SYMBOLS to export all symbols by default. WINDOWS_EXPORT_ALL_SYMBOLS does not work for metaobjects, as mentioned in my post.

            Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #4

            Apart from the fact that WINDOWS_EXPORT_ALL_SYMBOLS is imho a hack for lazy devs - please provide a minimal, compilable example. I don't see why the metaobject stuff should not be exported.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            C 1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              Apart from the fact that WINDOWS_EXPORT_ALL_SYMBOLS is imho a hack for lazy devs - please provide a minimal, compilable example. I don't see why the metaobject stuff should not be exported.

              C Offline
              C Offline
              Creaperdown
              wrote on last edited by Creaperdown
              #5

              @Christian-Ehrlicher I have previously added the export macro to all classes, which worked, but I would prefer not to need these macros.

              I have now removed them again to get back to the error back, and even though I set: set(WINDOWS_EXPORT_ALL_SYMBOLS ON) at the top of the CMakeLists.txt that creates the domain symbols I get:

              Unresolved external symbol ""public: static struct QMetaObject const domain::entities::User::staticMetaObject" (?staticMetaObject@User@entities@domain@@2UQMetaObject@@B)". [C:\Users\prt
              np\Librum\build\src\application\application.vcxproj]
              
              C 1 Reply Last reply
              0
              • C Creaperdown

                @Christian-Ehrlicher I have previously added the export macro to all classes, which worked, but I would prefer not to need these macros.

                I have now removed them again to get back to the error back, and even though I set: set(WINDOWS_EXPORT_ALL_SYMBOLS ON) at the top of the CMakeLists.txt that creates the domain symbols I get:

                Unresolved external symbol ""public: static struct QMetaObject const domain::entities::User::staticMetaObject" (?staticMetaObject@User@entities@domain@@2UQMetaObject@@B)". [C:\Users\prt
                np\Librum\build\src\application\application.vcxproj]
                
                C Offline
                C Offline
                Creaperdown
                wrote on last edited by
                #6

                @Christian-Ehrlicher I am pretty sure that there is a limitation of WINDOWS_EXPORT_ALL_SYMBOLS, namely that it can not export static symbols. Do you know some way around that for Qt?

                Christian EhrlicherC 1 Reply Last reply
                0
                • C Creaperdown

                  @Christian-Ehrlicher I am pretty sure that there is a limitation of WINDOWS_EXPORT_ALL_SYMBOLS, namely that it can not export static symbols. Do you know some way around that for Qt?

                  Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by Christian Ehrlicher
                  #7

                  Use proper export macros and/or create a cmake bug report.
                  Using the correct macros will also help the compiler / optimizer and the link & loading speed on linux.

                  /edit: See the documentation about static symbols - so no need to create a bug report.

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  1 Reply Last reply
                  0
                  • C Creaperdown has marked this topic as solved on

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved