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. Linking against release qt in debug dll
Forum Updated to NodeBB v4.3 + New Features

Linking against release qt in debug dll

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 4 Posters 4.9k 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.
  • O Offline
    O Offline
    OmegaDoom
    wrote on last edited by
    #1

    Hello. I have a dll which is a plugin in other application. The application links against release qt. My debug dll(plugin) also uses qt. I can't get this combination work for some reason. If i link my dll against release qt then I have crashes then I try to use any qt function. If I link my dll against debug qt then I have a message - "qwidget: must construct a qapplication before a qpaintdevice." Does someone have a clue why it can happen? Btw, I use dynamic qt.

    aha_1980A 1 Reply Last reply
    0
    • O OmegaDoom

      Hello. I have a dll which is a plugin in other application. The application links against release qt. My debug dll(plugin) also uses qt. I can't get this combination work for some reason. If i link my dll against release qt then I have crashes then I try to use any qt function. If I link my dll against debug qt then I have a message - "qwidget: must construct a qapplication before a qpaintdevice." Does someone have a clue why it can happen? Btw, I use dynamic qt.

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @OmegaDoom Are you on Windows?

      It's impossible to mix Debug and Release libraries in one program there.

      Qt has to stay free or it will die.

      1 Reply Last reply
      2
      • O Offline
        O Offline
        OmegaDoom
        wrote on last edited by
        #3

        Yes, it's windows. I think it's possible to mix debug and release as long as we use dynamic linking.

        JonBJ 1 Reply Last reply
        0
        • O Offline
          O Offline
          OmegaDoom
          wrote on last edited by
          #4

          I got it. It's not possible to use different configurations for qt and app because runtimes interpret memory differently when we pass object to qt and back. It workes fine only for simple types like int or char*.

          1 Reply Last reply
          0
          • O OmegaDoom

            Yes, it's windows. I think it's possible to mix debug and release as long as we use dynamic linking.

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #5

            @OmegaDoom said in Linking against release qt in debug dll:

            Yes, it's windows. I think it's possible to mix debug and release as long as we use dynamic linking.

            I don't think it is possible for any one given LIB, or DLL if using dynamic linking (e.g. the Qt libraries). That would mean that for a given symbol (e.g. functionName) there would be two available definitions --- one in the release DLL, one in the debug, DLL, and I don't see how that would work. (Depends I suppose on just exactly what "dynamic linking" means.)

            But anyway as you say if you're trying to pass Qt objects between release & debug versions of the libraries, that is likely never to work, if Qt has put extra stuff into them when building for debug.

            1 Reply Last reply
            0
            • O Offline
              O Offline
              OmegaDoom
              wrote on last edited by
              #6

              My question was not about mixing the same library in different configurations but about let's say using release dll from other debug dll or app.

              JonBJ 1 Reply Last reply
              0
              • O OmegaDoom

                My question was not about mixing the same library in different configurations but about let's say using release dll from other debug dll or app.

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #7

                @OmegaDoom
                You wrote:

                The application links against release qt. My debug dll(plugin) also uses qt.

                Application uses release Qt libraries. Application uses plugin, plugin uses debug Qt libraries. That's my idea of "different versions of same libraries".

                O 1 Reply Last reply
                0
                • JonBJ JonB

                  @OmegaDoom
                  You wrote:

                  The application links against release qt. My debug dll(plugin) also uses qt.

                  Application uses release Qt libraries. Application uses plugin, plugin uses debug Qt libraries. That's my idea of "different versions of same libraries".

                  O Offline
                  O Offline
                  OmegaDoom
                  wrote on last edited by OmegaDoom
                  #8

                  @JNBarchan said in Linking against release qt in debug dll:

                  @OmegaDoom
                  You wrote:

                  The application links against release qt. My debug dll(plugin) also uses qt.

                  Application uses release Qt libraries. Application uses plugin, plugin uses debug Qt libraries. That's my idea of "different versions of same libraries".

                  You are right but It's not working anyway. If I use "debug" plugin and "release" qt then I can't pass let's say std::string to qt because its "release" runtime will interpret it incorrectly. And I can't use "debug" plugin + "debug" qt because application uses release qt. It's very unfortunate because debug version of app is extremely slow. Yes, I have debug app but it's so slow that it's impractical to use.

                  JonBJ 1 Reply Last reply
                  0
                  • O OmegaDoom

                    @JNBarchan said in Linking against release qt in debug dll:

                    @OmegaDoom
                    You wrote:

                    The application links against release qt. My debug dll(plugin) also uses qt.

                    Application uses release Qt libraries. Application uses plugin, plugin uses debug Qt libraries. That's my idea of "different versions of same libraries".

                    You are right but It's not working anyway. If I use "debug" plugin and "release" qt then I can't pass let's say std::string to qt because its "release" runtime will interpret it incorrectly. And I can't use "debug" plugin + "debug" qt because application uses release qt. It's very unfortunate because debug version of app is extremely slow. Yes, I have debug app but it's so slow that it's impractical to use.

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #9

                    @OmegaDoom

                    If I use "debug" plugin and "release" qt then I can't pass let's say std::string to qt because its "release" runtime will interpret it incorrectly.

                    Yup, that's exactly the case. Which is why we are saying you cannot mix release & debug libraries.

                    Which appears to leave you with:

                    • At release time, use release of both app & your plugin, which is fast.
                    • While developing, if you need to debug your plugin, use debug of both app & your plugin, and put up with it being slow when you have to debug.
                    1 Reply Last reply
                    2
                    • mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Hi
                      If using visual studio compiler please check this
                      https://stackoverflow.com/questions/42764166/vs-2017-very-slow-laggy-when-debugging

                      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