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. Unload Qlibrary
Forum Updated to NodeBB v4.3 + New Features

Unload Qlibrary

Scheduled Pinned Locked Moved Solved General and Desktop
15 Posts 5 Posters 4.2k Views 3 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.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi
    You should be able to call
    http://doc.qt.io/qt-5/qlibrary.html#unload
    if you are the only instance using the DLL.
    Else You cannot unload it.

    Also
    "Note that on Mac OS X 10.3 (Panther), dynamic libraries cannot be unloaded."

    ZoptuneZ 1 Reply Last reply
    3
    • ZoptuneZ Zoptune

      Hi,

      I'm using a DLL with QLibrary in order to control a machine.

      I load the library and resole functions.
      Then i call an init() function from the library.

      When the machine is not detected on the network, this function return -1 and i can't unload the library. I close all the windows and the app crash fiew seconds later.

      Thx for help

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #3

      @Zoptune Why does it crash? What does the debugger say?

      ZoptuneZ 1 Reply Last reply
      2
      • mrjjM mrjj

        Hi
        You should be able to call
        http://doc.qt.io/qt-5/qlibrary.html#unload
        if you are the only instance using the DLL.
        Else You cannot unload it.

        Also
        "Note that on Mac OS X 10.3 (Panther), dynamic libraries cannot be unloaded."

        ZoptuneZ Offline
        ZoptuneZ Offline
        Zoptune
        wrote on last edited by
        #4

        @mrjj

        I think I'm the only instance using the DLL
        When the machine is detected on the network, unload work fine.

        mrjjM 1 Reply Last reply
        0
        • ZoptuneZ Zoptune

          @mrjj

          I think I'm the only instance using the DLL
          When the machine is detected on the network, unload work fine.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #5

          @Zoptune
          Ok. it sounds like the DLL does something in init() when it fails.
          You need to look at that code to know.

          ZoptuneZ 1 Reply Last reply
          1
          • ? A Former User

            @Zoptune Why does it crash? What does the debugger say?

            ZoptuneZ Offline
            ZoptuneZ Offline
            Zoptune
            wrote on last edited by
            #6

            @Wieland
            When the machine is not detected, my app is useless. So i just close it.
            Closing my app call the unload function in an object destructor.
            Then i quit and wait the thread where the DLL was used and stop the app.

            But when all windows are closed and app seems to be stoped, i don't have any message like :

            PATH\debug\test.exe exited with code 0

            4 or 5 seconds later i have the message :

            PATH\debug\test.exe crashed

            1 Reply Last reply
            0
            • mrjjM mrjj

              @Zoptune
              Ok. it sounds like the DLL does something in init() when it fails.
              You need to look at that code to know.

              ZoptuneZ Offline
              ZoptuneZ Offline
              Zoptune
              wrote on last edited by
              #7

              @mrjj
              I haven't got the code of the DLL ><

              mrjjM 1 Reply Last reply
              0
              • ZoptuneZ Zoptune

                @mrjj
                I haven't got the code of the DLL ><

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #8

                @Zoptune
                Oh. It seems that on fail (-1), it might spawn something or
                be in funny state so it sounds like its still active
                when App is closed.

                What DLL is it?

                ZoptuneZ 1 Reply Last reply
                1
                • mrjjM mrjj

                  @Zoptune
                  Oh. It seems that on fail (-1), it might spawn something or
                  be in funny state so it sounds like its still active
                  when App is closed.

                  What DLL is it?

                  ZoptuneZ Offline
                  ZoptuneZ Offline
                  Zoptune
                  wrote on last edited by
                  #9

                  @mrjj
                  It's a DLL provided by the manufacturer of the machine.
                  They have their own software to control the machine but this software doesn't match my company needs.
                  So they provided us the DLL and the documentation and i'm developing our soft.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    Hi,

                    Out of curiosity, why not link your application to that library ? Or do you only got the .dll file ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    ZoptuneZ 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Hi,

                      Out of curiosity, why not link your application to that library ? Or do you only got the .dll file ?

                      ZoptuneZ Offline
                      ZoptuneZ Offline
                      Zoptune
                      wrote on last edited by
                      #11

                      @SGaist
                      Yes i only got the DLL file ><

                      1 Reply Last reply
                      0
                      • m.sueM Offline
                        m.sueM Offline
                        m.sue
                        wrote on last edited by
                        #12

                        Hi,
                        they gave you the DLL and the documentation. So you could ask them about the error.
                        -Michael.

                        ZoptuneZ 1 Reply Last reply
                        0
                        • m.sueM m.sue

                          Hi,
                          they gave you the DLL and the documentation. So you could ask them about the error.
                          -Michael.

                          ZoptuneZ Offline
                          ZoptuneZ Offline
                          Zoptune
                          wrote on last edited by
                          #13

                          @m.sue
                          I send them an email.

                          I created this topic to ask if it was possible that the problem came from my side.

                          mrjjM 1 Reply Last reply
                          0
                          • ZoptuneZ Zoptune

                            @m.sue
                            I send them an email.

                            I created this topic to ask if it was possible that the problem came from my side.

                            mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on last edited by
                            #14

                            @Zoptune
                            If you do not touch any function in the DLL after you call init() and it return -1, then
                            its not likely its in your code.
                            Also, would be fast to make small test project and test this.

                            1 Reply Last reply
                            1
                            • ZoptuneZ Offline
                              ZoptuneZ Offline
                              Zoptune
                              wrote on last edited by
                              #15

                              Hi,

                              I made several tests and i'm sure that the problem comes from the DLL.

                              Thx all, and sorry to have wasted your time ^^'

                              1 Reply Last reply
                              1

                              • Login

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