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. Is it possible to delay load QtGui4.dll in Windows?
Forum Updated to NodeBB v4.3 + New Features

Is it possible to delay load QtGui4.dll in Windows?

Scheduled Pinned Locked Moved General and Desktop
18 Posts 5 Posters 13.5k 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.
  • F Offline
    F Offline
    frinker
    wrote on last edited by
    #1

    Hi,

    I have an application which has to delay load the Qt libraries. The application contains several Qt dialog. I can successfully delay-load QtCore, but when I was trying to delay-load the QtGui, it failed with LNK1194.
    _
    _LINK : fatal error LNK1194: cannot delay-load 'QtGuid4.dll' due to import of data symbol '"__declspec(dllimport) public: static struct QMetaObject const QDialog::staticMetaObject" (_imp?staticMetaObject@QDialog@@2UQMetaObject@@B)'; link without /DELAYLOAD:QtGuid4.dll
    _

    it seems like the static variable caused the problem. So is it possible to delay load QtGui4.dll? And how?

    Thanks,

    D.J.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      You need QApplication before even constructing a QWidget based object. As QApplication is located in QtGui4.dll it will be loaded immediately after starting your program. So why delay-load it? I see no sense in that.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        and QtCore will be loaded by QtGui, so what do you mean by delay loading? Load via LoadLibrary?

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • L Offline
          L Offline
          loladiro
          wrote on last edited by
          #4

          @Gerolf It's a windows thing ("example":http://www.codeproject.com/KB/DLL/Delay_Loading_Dll.aspx)

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #5

            [quote author="loladiro" date="1308906058"]@Gerolf It's a windows thing ("example":http://www.codeproject.com/KB/DLL/Delay_Loading_Dll.aspx)[/quote]

            That does not answer any questions you've been asked.

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • L Offline
              L Offline
              loladiro
              wrote on last edited by
              #6

              [quote author="Volker" date="1308906327"]
              [quote author="loladiro" date="1308906058"]@Gerolf It's a windows thing ("example":http://www.codeproject.com/KB/DLL/Delay_Loading_Dll.aspx)[/quote]

              That does not answer any questions you've been asked.[/quote]

              True, but I was pointing out what delay loading is (not everybody necessarily knows that. But to answer the question:
              http://msdn.microsoft.com/en-us/library/yx1x886y(v=vs.71).aspx
              [quote]

              Imports of data cannot be supported. A workaround is to explicitly handle the data import yourself using LoadLibrary (or GetModuleHandle after you know the delay-load helper has loaded the DLL) and GetProcAddress.

              [/quote]

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goetz
                wrote on last edited by
                #7

                [quote author="loladiro" date="1308906878"][quote author="Volker" date="1308906327"]
                [quote author="loladiro" date="1308906058"]@Gerolf It's a windows thing ("example":http://www.codeproject.com/KB/DLL/Delay_Loading_Dll.aspx)[/quote]

                That does not answer any questions you've been asked.[/quote]

                True, but I was pointing out what delay loading is (not everybody necessarily knows that. But to answer the question:
                http://msdn.microsoft.com/en-us/library/yx1x886y(v=vs.71).aspx
                [quote]

                Imports of data cannot be supported. A workaround is to explicitly handle the data import yourself using LoadLibrary (or GetModuleHandle after you know the delay-load helper has loaded the DLL) and GetProcAddress.

                [/quote][/quote]

                Thanks. I know how to use google to know what delay loading is.

                That still does not answer the question why you want or need it in your application.

                http://www.catb.org/~esr/faqs/smart-questions.html

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  loladiro
                  wrote on last edited by
                  #8

                  I'm not the OP

                  EDIT: And I actually wouldn't use delay loading

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goetz
                    wrote on last edited by
                    #9

                    [quote author="loladiro" date="1308907102"]I'm not the OP

                    EDIT: And I actually wouldn't use delay loading[/quote]

                    Oops. I'm very sorry, I totally misread this :-( Please accept my apologies.

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      loladiro
                      wrote on last edited by
                      #10

                      No problem :). Now I understand at least why you said it ;)

                      1 Reply Last reply
                      0
                      • F Offline
                        F Offline
                        frinker
                        wrote on last edited by
                        #11

                        Thank you guys, I'm sorry I didn't say it clearly. The application is a plugin for Photoshop. And it seems that Photoshop wouldn't have the plugin folder included in the dll search path. (see my question in the ps forum http://forums.adobe.com/message/3759318#3759318). That's why I have to delay load the qt libraries - I want to have a chance to call 'SetDllDirectory' to find the qt libraries.

                        I guess it's the import data problem. But the thing is my dialog is generated by .ui (uic, moc..), and I have no explicit reference to 'QDialog::staticMetaObject'

                        1 Reply Last reply
                        0
                        • G Offline
                          G Offline
                          giesbert
                          wrote on last edited by
                          #12

                          if you read MSND on that, it states:

                          bq. You should consider delay loading a DLL if:

                          • Your program may not call a function in the DLL.
                          • A function in the DLL may not get called until late in your program's execution.

                          As you typically have QtCore/QtGui components really early in main, I think it makes definitely no sense to delay load Qt libs, especially QtCore and QtGui

                          Nokia Certified Qt Specialist.
                          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                          1 Reply Last reply
                          0
                          • F Offline
                            F Offline
                            frinker
                            wrote on last edited by
                            #13

                            As I said, I have to delay load, because of the limitation of Photoshop (actually we have a feature request for them). Otherwise, I have to change system 'PATH' or 'app path' in registry to tell windows where to find Qt, or write another wrapper for my plugin, which would be ugly...

                            So let's back to the question, how can I delay load qt libraries if my Dll contains both the code of QApplication and QDialog?

                            1 Reply Last reply
                            0
                            • L Offline
                              L Offline
                              loladiro
                              wrote on last edited by
                              #14

                              Well, you could put the Qt libraries into the proper search path (if you don't want to copy your dll, you could have a look at "known dlls"). All versions new of Qt are binary compatible to older ones (within a major release e.g. Qt4), so their shouldn't be a problem with other programs using Qt either.

                              1 Reply Last reply
                              0
                              • G Offline
                                G Offline
                                giesbert
                                wrote on last edited by
                                #15

                                But the point is, you can't compile, right?
                                If the compiler does not allow delayload, I think, you can't delay load it, sorry.

                                [quote author="frinker" date="1308909013"]As I said, I have to delay load, because of the limitation of Photoshop (actually we have a feature request for them). Otherwise, I have to change system 'PATH' or 'app path' in registry to tell windows where to find Qt, or write another wrapper for my plugin, which would be ugly...
                                [/quote]

                                By the way, before, you did not say why you need it before, you just said, you want.

                                Nokia Certified Qt Specialist.
                                Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                                1 Reply Last reply
                                0
                                • C Offline
                                  C Offline
                                  cincirin
                                  wrote on last edited by
                                  #16

                                  I personally would prefer a plug-in proxy wrapper. I do not think it's so hard to change code : leave in main plugin just Photoshop calling function (advanceState, aquireSuite, etc.) and they will communicate dynamically with Qt proxy wrapper. However I know that "Alien Skin":http://www.alienskin.com/ use Qt in their plug-in development, and Qt dependent libraries are not in system32 or whatever known search path.

                                  1 Reply Last reply
                                  0
                                  • G Offline
                                    G Offline
                                    goetz
                                    wrote on last edited by
                                    #17

                                    We have a similar problem with an Adobe InDesign plugin. We just make an installer for the plugin and put the Qt DLLs into the InDesign application folder (we get the path from some registry entries). That's in the search path and we never needed any tricky stuff like delay loading.

                                    http://www.catb.org/~esr/faqs/smart-questions.html

                                    1 Reply Last reply
                                    0
                                    • F Offline
                                      F Offline
                                      frinker
                                      wrote on last edited by
                                      #18

                                      Thanks guys, I would like to write a proxy to wrap my plugin. I think it would be the easiest way to solve my problem.

                                      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