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. Architecture doubt: Plugin AND Standalone together
QtWS25 Last Chance

Architecture doubt: Plugin AND Standalone together

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 603 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
    fem_dev
    wrote on last edited by
    #1

    I would like to improve the conceptual architecture and modularity of my new software using Qt.

    I was thinking to develop a "main application" and a set of "plugins" (shared libraries) to expand the "main application" features.

    I already did a simple test of this:
    1- I Build a custom shared library (I'm calling this a "plugin with UI")
    2- I Build the main application that uses QPluginLoader class to load shared libraries
    3- When the main application starts, it loads dynamically all "plugins" that are located in a specific folder.
    4- All running good! It works!

    So, my doubt is that I would like to each "plugin" can run alone too...like a standalone executable application.
    I would like to "double-click" on each plugin, or call it using the Terminal/Console...pass some input arguments...and get it running without the "main application".

    If this is possible, my architecture will be based on develop each "plugin" like a "software segment" that is completely autonomous (like a executable)

    BUT, if this plugin file is located inside a "plugins folder"... When the "main application" start, it will can load it dinamically too (like a shared library).

    The feature of "load dinamicaly" is important to be able to create custom menus and internal options inside the "main application".
    And in the future, other people will develop new "plugins" to this "main application". So I can't "lock" this dynamic load feature.

    Is there any way to "mix" this two file behaviors (executable and shared library)? How to do it?

    Pablo J. RoginaP 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      you will have to use a loader app. Shared libs cannot also be
      an executable in that sense.

      F 1 Reply Last reply
      2
      • F fem_dev

        I would like to improve the conceptual architecture and modularity of my new software using Qt.

        I was thinking to develop a "main application" and a set of "plugins" (shared libraries) to expand the "main application" features.

        I already did a simple test of this:
        1- I Build a custom shared library (I'm calling this a "plugin with UI")
        2- I Build the main application that uses QPluginLoader class to load shared libraries
        3- When the main application starts, it loads dynamically all "plugins" that are located in a specific folder.
        4- All running good! It works!

        So, my doubt is that I would like to each "plugin" can run alone too...like a standalone executable application.
        I would like to "double-click" on each plugin, or call it using the Terminal/Console...pass some input arguments...and get it running without the "main application".

        If this is possible, my architecture will be based on develop each "plugin" like a "software segment" that is completely autonomous (like a executable)

        BUT, if this plugin file is located inside a "plugins folder"... When the "main application" start, it will can load it dinamically too (like a shared library).

        The feature of "load dinamicaly" is important to be able to create custom menus and internal options inside the "main application".
        And in the future, other people will develop new "plugins" to this "main application". So I can't "lock" this dynamic load feature.

        Is there any way to "mix" this two file behaviors (executable and shared library)? How to do it?

        Pablo J. RoginaP Offline
        Pablo J. RoginaP Offline
        Pablo J. Rogina
        wrote on last edited by
        #3

        @fem_dev have you already check the overview of plugins support in Qt?

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        F 1 Reply Last reply
        0
        • mrjjM mrjj

          Hi
          you will have to use a loader app. Shared libs cannot also be
          an executable in that sense.

          F Offline
          F Offline
          fem_dev
          wrote on last edited by
          #4

          @mrjj thank you...where can I find the documentation or some example of Qt "Loader App"? Could you help me?

          mrjjM 1 Reply Last reply
          0
          • Pablo J. RoginaP Pablo J. Rogina

            @fem_dev have you already check the overview of plugins support in Qt?

            F Offline
            F Offline
            fem_dev
            wrote on last edited by
            #5

            Yes, @pablo-j-rogina, but in my view, I don't know if this page can help me in this question...Am'I wrong?

            1 Reply Last reply
            0
            • F fem_dev

              @mrjj thank you...where can I find the documentation or some example of Qt "Loader App"? Could you help me?

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

              @fem_dev
              Hi
              That would be exactly like your main app.
              However, just a much smaller app that uses
              https://doc.qt.io/qt-5/qpluginloader.html
              to start the so files with a parameter that tells them
              to be in standalone mode.

              F 1 Reply Last reply
              0
              • mrjjM mrjj

                @fem_dev
                Hi
                That would be exactly like your main app.
                However, just a much smaller app that uses
                https://doc.qt.io/qt-5/qpluginloader.html
                to start the so files with a parameter that tells them
                to be in standalone mode.

                F Offline
                F Offline
                fem_dev
                wrote on last edited by
                #7

                @mrjj I don't understand how to do it...

                In my mind, a plugin is just a single file shared library (*.dll or *.so)...So, I think that this kind of file cannot be tested itself. This dynamic library file must have a main application that loaded it using QPluginLoader. Am I right?

                So, my question is about how to create a special type of Qt Project that will output a build file that will haveboth behaviors: standalone application AND a dynamic library?

                I would like to have something like: my_plugin.extension
                And put this file inside my Main Application plugins folder...like:

                C:\Program Files\My Application\Plugins\my_plugin.extension
                

                Case 1: Load plugin as a dynamic library
                I already done this using QPluginLoader and a *.dll or *.so file...it works great!

                Case 2: Run the plugin like a standalone application
                a) If I go to the "plugins folder" and double-click the my_plugin.extension file, it will show the UI (window, button, etc..) and execute some code without the main application
                b) If I go to the Terminal/Console and call it like: .\my_plugin.extension it will show the UI too and execute some code without the main application

                Is it possible?

                mrjjM 1 Reply Last reply
                0
                • F fem_dev

                  @mrjj I don't understand how to do it...

                  In my mind, a plugin is just a single file shared library (*.dll or *.so)...So, I think that this kind of file cannot be tested itself. This dynamic library file must have a main application that loaded it using QPluginLoader. Am I right?

                  So, my question is about how to create a special type of Qt Project that will output a build file that will haveboth behaviors: standalone application AND a dynamic library?

                  I would like to have something like: my_plugin.extension
                  And put this file inside my Main Application plugins folder...like:

                  C:\Program Files\My Application\Plugins\my_plugin.extension
                  

                  Case 1: Load plugin as a dynamic library
                  I already done this using QPluginLoader and a *.dll or *.so file...it works great!

                  Case 2: Run the plugin like a standalone application
                  a) If I go to the "plugins folder" and double-click the my_plugin.extension file, it will show the UI (window, button, etc..) and execute some code without the main application
                  b) If I go to the Terminal/Console and call it like: .\my_plugin.extension it will show the UI too and execute some code without the main application

                  Is it possible?

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

                  @fem_dev
                  Hi
                  Case 2 is not possible with the DLL/so files alone.
                  It has to be loaded via some other app using QPluginLoader/QLibrary

                  1 Reply Last reply
                  2

                  • Login

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