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. Loading dynamic library issue
Forum Updated to NodeBB v4.3 + New Features

Loading dynamic library issue

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 2.8k 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.
  • N Offline
    N Offline
    neel2818
    wrote on last edited by
    #1

    Hi All,

    I have one dynamic library as we are loading at run time from code so we have common code that are working on both windows and linux.

    In windows name of librayr is library.dll and for linux it is liblibrary.so file. If i want to load the library and put the code common then is there any functionality in Qt that will internally take care of architecture ?

    I don't want to put the ifdef macro for architecture

    Please let me know how can i do through common code for windows and linux for loading the dynamic library ?

    Thanks,

    1 Reply Last reply
    0
    • P Offline
      P Offline
      pkj__
      wrote on last edited by
      #2

      So does this library have different api depending on linux or windows?
      if not you can tell it in .pro file to use the particular file...
      Something like
      win32 {
      }
      and
      unix {
      }
      in your pro file

      1 Reply Last reply
      0
      • N Offline
        N Offline
        neel2818
        wrote on last edited by
        #3

        I don't want to add in .pro file.
        Is there any common method in Qt that will load both the .dll and .so file i don't want to give extension while giving the library name so implementation will remain common.

        Please suggest.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          twsimpson
          wrote on last edited by
          #4

          "QLibrary":http://qt-project.org/doc/qt-4.8/qlibrary.html takes care of that for you, you only need to load "library" and Qt will add the platform-specific parts of the file name for you.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tobias.hunger
            wrote on last edited by
            #5

            No, there is no way to use the same library on windows and linux. You can use the same source code and build two libraries (one for linux, one for windows).

            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