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. Resolving a symbol in memory
QtWS25 Last Chance

Resolving a symbol in memory

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

    Hi,
    My problem is the following: I have a Qt application that depends on a shared library. Thus, this shared library is automatically loaded in memory when my application starts.
    Now, I want to check for a symbol in this library (which doesn't only depends on the library version). How can I do ?
    When I use QLibrary, I have to call 'QLibrary::load' to resolve the symbol but the library is supposed to be already loaded. Isn't it possible to query the symbols available in memory ?

    Dominique

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #2

      Why would the symbols be available in memory if your application already got the relevant pointers at the link stage?

      There's a good possibility that QLibrary::load() won't actually load the library again. It just needs to know about the exported symbols. I'm not sure though. Did you try and see what the results were?

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

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

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fober
        wrote on last edited by
        #3

        bq. Why would the symbols be available in memory if your application already got the relevant pointers at the link stage?

        actually it doesn't since I don't make an explicit reference to the symbol and I want to avoid that. It's a kind of dynamic weak link.

        bq. There’s a good possibility that QLibrary::load() won’t actually load the library again. It just needs to know about the exported symbols. I’m not sure though. Did you try and see what the results were?

        I though about that possibility (library not loaded again) but how can I check ?

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Franzk
          wrote on last edited by
          #4

          So you're just dynamically linking?

          "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

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

          1 Reply Last reply
          0
          • F Offline
            F Offline
            fober
            wrote on last edited by
            #5

            yes, but only partially since the other symbols are resolved the usual way.
            Actually I don't want the application to issue a link error at run time for a specific symbol (which I can safely ignore when not present - I simply disable the corresponding feature)

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

              libraries are loaded with some kind of ref counting. It is safe to load them twice, but take care to also release them twice. Otherwise they are removed only at the end of the application.

              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
                fober
                wrote on last edited by
                #7

                ok
                thanks, that should 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