Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. How to check plugins for unique class names?
QtWS25 Last Chance

How to check plugins for unique class names?

Scheduled Pinned Locked Moved Solved 3rd Party Software
7 Posts 3 Posters 2.0k Views
  • 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.
  • trialuserT Offline
    trialuserT Offline
    trialuser
    wrote on last edited by trialuser
    #1

    Hello, developers.
    Due to recent Qt changes forms with same names can conflict. See https://bugreports.qt.io/browse/QTBUG-54354. According to Qt developers this is not a bug. So, I need solution to check all plugins of my application. Which tool should I use for this task? Also, It would be good to provide this tool for third-party plugin developers.

    raven-worxR 1 Reply Last reply
    0
    • trialuserT trialuser

      Hello, developers.
      Due to recent Qt changes forms with same names can conflict. See https://bugreports.qt.io/browse/QTBUG-54354. According to Qt developers this is not a bug. So, I need solution to check all plugins of my application. Which tool should I use for this task? Also, It would be good to provide this tool for third-party plugin developers.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @trialuser
      why do you expect a magical tool which solves your issues when the bug report already says that it's not possible?
      There are problems in the programming world which are only solvable when every developer follows some guidelines for clean design.

      E.g. you can make sure that your class names are always starting with your (companies) initials. When a developer isn't willing to follow such rules it's the developers responsibility to fix it or to live with the fact that his software isn't usable by everyone.

      Just my opinion.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • trialuserT Offline
        trialuserT Offline
        trialuser
        wrote on last edited by
        #3

        Unfortunately, I can not find any official guidelines about class naming inside Qt plugins. Also, I don't know why Qt plugins with same form names works fine in Qt 5.5 and lower. So, I'll be glad, if you give me information about recent changes which causes this problem. I tell "Qt plugins" because other plugins (pure c++ and dlopen) have not this problem.

        raven-worxR 1 Reply Last reply
        0
        • trialuserT trialuser

          Unfortunately, I can not find any official guidelines about class naming inside Qt plugins. Also, I don't know why Qt plugins with same form names works fine in Qt 5.5 and lower. So, I'll be glad, if you give me information about recent changes which causes this problem. I tell "Qt plugins" because other plugins (pure c++ and dlopen) have not this problem.

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @trialuser
          did you read the comments on the bug page?

          Also there is no such guideline for Qt plugins. A possible convention could be your or your companies companies initials, followed by the plugin-type and the name.

          E.g. QxxImageFormatSomenewformatPlugin

          Who knows, maybe they will fix it in the end anyway.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • trialuserT Offline
            trialuserT Offline
            trialuser
            wrote on last edited by
            #5

            Thank you. Recently I found another solution. This problem was resolved by recompiling all plugins with -fvisibility=hidden. Now my application works fine, but I don't know is this correct. Should I recommend other developers to add CONFIG += HIDE_SYMBOLS to .pro files instead of class renaming?

            kshegunovK 1 Reply Last reply
            0
            • trialuserT trialuser

              Thank you. Recently I found another solution. This problem was resolved by recompiling all plugins with -fvisibility=hidden. Now my application works fine, but I don't know is this correct. Should I recommend other developers to add CONFIG += HIDE_SYMBOLS to .pro files instead of class renaming?

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by kshegunov
              #6

              @trialuser
              Hi,
              This is a typical Linux issue and will not be present on win (except for a special case with mingw). By default on Linux symbols are exported, while Windows requires a specific set of compiler directives (the infamous __declspec(dllexport) and __declspec(dllimport)). As a Qt plugin is no different ABI-wise from a regular dynamic library, then yes, Thiago is absolutely correct that the problem is with your code.

              In the usual case the library's symbols are resolved by the loader, so such symbol conflicts are removed at link-time. In the case of plugins the symbol resolution is at runtime, so the errors are obvious much later (when the app is already running). This is neither a problem with Qt, the Qt's version, nor with the compiler.

              What you can do is to require from your plugin developers to put their classes in their own namespaces and/or prefix the classes by some "unique" means.

              Another thing is to "hide" the unnecessarily exported symbols - you can use Q_DECL_HIDDEN for that (much like Q_DECL_EXPORT is used).

              If you're talking about uic generated classes (widget forms), then you're out of luck as uic cares not about the export of symbols and will not put the appropriate macros to hide the form classes (thus they get exported). In this case you can enforce the symbols to not be exported with -fvisibility=hidden.

              Kind regards.

              Read and abide by the Qt Code of Conduct

              1 Reply Last reply
              2
              • trialuserT Offline
                trialuserT Offline
                trialuser
                wrote on last edited by trialuser
                #7

                Ok, I understood. Thank you. Please, mark this topic as 'solved'.

                1 Reply Last reply
                0

                • Login

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