Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Static plugin VS static library

Static plugin VS static library

Scheduled Pinned Locked Moved 3rd Party Software
5 Posts 2 Posters 6.1k 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.
  • L Offline
    L Offline
    luca
    wrote on 26 May 2011, 09:43 last edited by
    #1

    Hi all,
    these days I'm doing some tests with Qt Plugin but I didn't understand very well how it works.

    I'm checking the "Plug & Paint" example. This example use static and dynamic plugin .

    When I use shared or static library in my Qt project I don't need to use QPluginLoader .
    For example to use QExtSerialPort I only need to add to my .pro :
    @
    INCLUDEPATH += ../qextserialport_x86
    QMAKE_LIBDIR += ../qextserialport_x86/build
    LIBS += -lqextserialport
    DEFINES = TTY_POSIX
    @

    But what are the main differences between static plugin and static library ?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on 26 May 2011, 09:50 last edited by
      #2

      Short story: a plugin is a library with a predefined interface, be static or shared doesn't matter.

      EDIT:
      Oh, and plugins are usually not needed to fire up an application, as they are usually loaded by the app itself. Whereas regular (shared) libraries are needed to run the app, because they are loaded by the operating system. Missing a library causes the operating system to bail out with - hopefully - an error message.

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

      1 Reply Last reply
      0
      • L Offline
        L Offline
        luca
        wrote on 26 May 2011, 09:57 last edited by
        #3

        [quote author="Volker" date="1306403458"]Short story: a plugin is a library with a predefined interface, be static or shared doesn't matter.

        EDIT:
        Oh, and plugins are usually not needed to fire up an application, as they are usually loaded by the app itself. Whereas regular (shared) libraries are needed to run the app, because they are loaded by the operating system. Missing a library causes the operating system to bail out with - hopefully - an error message.[/quote]

        Thanks Volker.
        Does a static plugin is required to start an application? If yes it's the same of a library.

        What is the main reasons because of QExtSerialPort is a library and not a plugin. Shouldn't it be better as a plugin?

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on 26 May 2011, 10:14 last edited by
          #4

          A static plugin is compiled into the exe. Otherwise it would not be static :-)

          A plugin is optional, a library is required (shortened view, one could construct examples where it is the other way round)

          See it like the SQL support in Qt:

          • QtSql4.dll is the libraray, it provides the core functionality
          • libqsqlite.dll, libsqsqlmysql.dll are the drivers and work as plugins

          This way you can easily write your own SQL driver and don't need to relink your application or recompile the QtSql lib.

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

          1 Reply Last reply
          0
          • L Offline
            L Offline
            luca
            wrote on 26 May 2011, 10:16 last edited by
            #5

            Ok, thanks.
            Now it's more clear.

            1 Reply Last reply
            0

            1/5

            26 May 2011, 09:43

            • Login

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