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. [Solved] Can I read the info inside a *.dll and build it dynamically?
Forum Updated to NodeBB v4.3 + New Features

[Solved] Can I read the info inside a *.dll and build it dynamically?

Scheduled Pinned Locked Moved General and Desktop
13 Posts 4 Posters 2.9k Views 2 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.
  • R Offline
    R Offline
    roseicollis
    wrote on last edited by roseicollis
    #1

    Hi,

    I'm making a gui app on a fedora system (unix) and I need to read a *.dll (i.e: myLibrary.dll) to load some of the information that contains inside. So the question is:

    • Is there a way to do it?
      • if YES can I then build the release with the dll dynamically so I just need the *.exe to run it?
      • if NOT do you know any 'simple' solution to get what I need?

    Thank you so much!

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

      Hi,

      What do you need to read from it ?

      Something's a bit mixed up, are you referring to linux's shared libraries (*.so files) or do you really want to read a windows DLL ?

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

      R ? 2 Replies Last reply
      0
      • SGaistS SGaist

        Hi,

        What do you need to read from it ?

        Something's a bit mixed up, are you referring to linux's shared libraries (*.so files) or do you really want to read a windows DLL ?

        R Offline
        R Offline
        roseicollis
        wrote on last edited by
        #3

        @SGaist Hi, yes I know its a bit complicated. The thing is:

        • in my work, they have a program in windos that reads the content of a *.dll (besides other things).
        • In my case: I am doing a wizard app (which does other things different s than the windows program) on a fedora that has to run on a unix system.

        Until now was all ok but now my boss wants a new functionality which is the part of the windows program that reads a specific *.dll (made by them with another program). This dll contains some info and its updaated with new info once in a while and I need to load this info in my program.

        So now I don't know if there is a way to read that dll content or .... tell them to do another file for my case or.... tell them to re-build it in other way (dunno fi they can build it in another extension like *.so for example and if then will I be able to read it).

        Hope that now its more clear. If not, plese tell me.

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          What do you need to read from it ?

          Something's a bit mixed up, are you referring to linux's shared libraries (*.so files) or do you really want to read a windows DLL ?

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

          @SGaist said:

          Hi,

          What do you need to read from it ?

          Something's a bit mixed up, are you referring to linux's shared libraries (*.so files) or do you really want to read a windows DLL ?

          *.so files are generated by Unix-like operating systems that use ELF like GNU. Linux is just a kernel.

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

            Are you binary reading these information from the DLL ?

            If you are expected to use that DLL on Fedora (or any other linux distro) then they will have to build it for it.

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

            R 1 Reply Last reply
            0
            • SGaistS SGaist

              Are you binary reading these information from the DLL ?

              If you are expected to use that DLL on Fedora (or any other linux distro) then they will have to build it for it.

              R Offline
              R Offline
              roseicollis
              wrote on last edited by roseicollis
              #6

              @SGaist I don't know how should I read it... in the case of the windows app it uses a delphi function to load the dll and does something like creating a pointer so you can access the functions inside the dll that returns the array of values I need

              I've copied the .dll file I need into my unix system and tried this code:

                  QLibrary *myLibrary= new QLibrary();
                  myLibrary->setFileName("/home/user/wk/folder1/Project/Resources/TheLibrary.dll");
                  myLibrary->load();
                  qDebug() << "myLibrary.filename" << myLibrary->fileName(); // returns  "/home/user/wk/folder1/Project/Resources/TheLibrary.dll"
                  qDebug() << "myLibrary.load" <<  myLibrary->load(); // returns false
                  qDebug() << "myLibrary.isLoaded" << myLibrary->isLoaded(); // returns false
                  qDebug() << " qerrorstring! " << myLibrary->errorString(); // returns invalid ELF header
              

              So maybe I can read the *.dll this way but I still don't know how to deal with the errorString I got...

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Meyer Sound
                wrote on last edited by
                #7

                QLibrary can only be used to access dynamic libraries built for the OS you are running on. So, you can't open a Windows DLL on a Unix machine.

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

                  Just one thing… Since this library is built for you, why do you need to do it like that ? Can't you just link against it ? Or is it some kind of plugin ?

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

                  R 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Just one thing… Since this library is built for you, why do you need to do it like that ? Can't you just link against it ? Or is it some kind of plugin ?

                    R Offline
                    R Offline
                    roseicollis
                    wrote on last edited by
                    #9

                    @SGaist Well it is not built for me, its for another program in windows but they wanted to re-use it if possible with my program and avoid having to change it for me.

                    @Meyer-Sound ohh... then I understood bad how QLibrary works. Thank you!

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

                      Unless I misunderstood you, that library is built in-house even if it's from another department, right ?

                      If so, why don't they provide you with the corresponding header and lib file so you can just use that library like any other ?

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

                      R 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        Unless I misunderstood you, that library is built in-house even if it's from another department, right ?

                        If so, why don't they provide you with the corresponding header and lib file so you can just use that library like any other ?

                        R Offline
                        R Offline
                        roseicollis
                        wrote on last edited by
                        #11

                        @SGaist yes that's it, but they wanted to avoid that if I could load it so first I "break my neck" with the problem. I've talk with them seeing that its totally impossible and I'm going to do it in another way for the moment.

                        Thank you so much for your help!

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

                          They will still have to build it for your OS. In any case you can take some inspiration from the OpenSSL code in Qt, they use the adequate method on each platform to use the DLL at runtime (unless you built Qt with OpenSSL linked)

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

                          R 1 Reply Last reply
                          1
                          • SGaistS SGaist

                            They will still have to build it for your OS. In any case you can take some inspiration from the OpenSSL code in Qt, they use the adequate method on each platform to use the DLL at runtime (unless you built Qt with OpenSSL linked)

                            R Offline
                            R Offline
                            roseicollis
                            wrote on last edited by
                            #13

                            @SGaist Nice! I'll keep it in mind. Thank you so much SGaist

                            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