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. Low Level Plugins
Forum Updated to NodeBB v4.3 + New Features

Low Level Plugins

Scheduled Pinned Locked Moved Solved General and Desktop
18 Posts 4 Posters 4.7k Views 3 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.
  • C Offline
    C Offline
    ckvsoft
    wrote on last edited by A Former User
    #1

    Hi

    I'm new with Plugins. I tray to write a little Plugin (Like EchoPlugin). It compiles without failures.

    But i ask me how i can Use Methods from the Core App?

    In my core app i use some classes and i will use some in the plugin.

    When i include the header files it compiles, but whe i call some Methods it kill my app.

    Can anyone help me.

    lg Chris

    kshegunovK 1 Reply Last reply
    0
    • C ckvsoft

      Hi

      I'm new with Plugins. I tray to write a little Plugin (Like EchoPlugin). It compiles without failures.

      But i ask me how i can Use Methods from the Core App?

      In my core app i use some classes and i will use some in the plugin.

      When i include the header files it compiles, but whe i call some Methods it kill my app.

      Can anyone help me.

      lg Chris

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      @ckvsoft said in QT Low Level Plugins:

      But i ask me how i can Use Methods from the Core App?

      You don't. Anything you wan't to use from the core app should be put in a dynamic library that's linked both in the plugin and the application.

      When i include the header files it compiles, but whe i call some Methods it kill my app.

      How do you call them? (please post a little bit of code)

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      1
      • C Offline
        C Offline
        ckvsoft
        wrote on last edited by
        #3

        Ok Thanks

        In the Plugin i call a static Method

        void Barcodes::printReceipt()
        {
        int id = Database::getLastReceiptNum(true);
        ...
        }

        In debug Mode i jump into printReceipt()
        and it stops without any Message bei calling Database::getLastReceiptNum(true)

        I tested it with a funktion call in a testlib which return a QString. Here it works, but i do not link it with the plugin ??? I only include the header ;-)

        I will check this. Thanks

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

          Hi,

          By definition, a static method doesn't work with any object and you can't apply polymorphism to it so what is that method exactly doing in your plugin ?

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

          1 Reply Last reply
          1
          • C Offline
            C Offline
            ckvsoft
            wrote on last edited by
            #5

            Hi

            This method only got a id from the last cashregister from a database. Now i export some things to a shared library. Now it works. Thx

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

              Good !

              Then, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)

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

              1 Reply Last reply
              1
              • C Offline
                C Offline
                ckvsoft
                wrote on last edited by
                #7

                Hi
                Sorry not cashregister. Receipt is the right one ;-)

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  ckvsoft
                  wrote on last edited by
                  #8

                  Sorry
                  I think it was solved, but it is't
                  I can compile under linux and it works. But under windows
                  i got "undefined reference to `imp__...." to near all of my functions in the shared library.

                  What can i missing? The library compiles and create a libcore.a file.

                  My src and the plugins got "undefined reference to `imp__"

                  lg Chris

                  kshegunovK 1 Reply Last reply
                  0
                  • C ckvsoft

                    Sorry
                    I think it was solved, but it is't
                    I can compile under linux and it works. But under windows
                    i got "undefined reference to `imp__...." to near all of my functions in the shared library.

                    What can i missing? The library compiles and create a libcore.a file.

                    My src and the plugins got "undefined reference to `imp__"

                    lg Chris

                    kshegunovK Offline
                    kshegunovK Offline
                    kshegunov
                    Moderators
                    wrote on last edited by
                    #9

                    @ckvsoft said in Low Level Plugins:

                    What can i missing?

                    Exports?

                    https://wiki.qt.io/How_to_create_a_library_with_Qt_and_use_it_in_an_application

                    Read and abide by the Qt Code of Conduct

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

                      As @kshegunov wrote, you didn't properly export your library's symbols. Take a look at the Creating Shared Libraries in Qt's documentation.

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

                      1 Reply Last reply
                      1
                      • C Offline
                        C Offline
                        ckvsoft
                        wrote on last edited by
                        #11

                        Thx
                        But

                        //#include "mysharedlib_global.h"
                        
                        MYSHAREDLIB_EXPORT void foo();
                        class MYSHAREDLIB_EXPORT MyClass...
                        
                        

                        But must i export all the Functions like void foo();
                        or only the Class

                        By static compile, must i include the Plugon or can i load it with QPluginLoader?
                        or must the plugion available at Compiletime?

                        If i compile Static, must there the whole Project and Plugins are static? or can i mix it.

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

                          All the functions you want to make available from your library.

                          If want to go static, then you have to handle your plugins differently and they will be linked to your application.

                          Exporting cleanly is the best way to go.

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

                          1 Reply Last reply
                          1
                          • C Offline
                            C Offline
                            ckvsoft
                            wrote on last edited by
                            #13

                            Thx
                            Also functions inside a class?
                            How i can handle plugins when the Main App is static? Can i load a plugin dll well?

                            LG chris

                            jsulmJ 1 Reply Last reply
                            0
                            • C ckvsoft

                              Thx
                              Also functions inside a class?
                              How i can handle plugins when the Main App is static? Can i load a plugin dll well?

                              LG chris

                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              @ckvsoft No, just export the class

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              1
                              • C Offline
                                C Offline
                                ckvsoft
                                wrote on last edited by
                                #15

                                Thx to all
                                I Export my classes but it do not work.
                                I found why i got "undefined reference to `imp__...."

                                When i use the Files from QUAZIP inside my Library this will not work.

                                When i make a lib for QUAZIP and than i link it to my lib it will work.

                                Now i do so, but have you an Idea why it to not work when i include the QUAZIP Files?

                                lg Chris

                                kshegunovK 1 Reply Last reply
                                0
                                • C ckvsoft

                                  Thx to all
                                  I Export my classes but it do not work.
                                  I found why i got "undefined reference to `imp__...."

                                  When i use the Files from QUAZIP inside my Library this will not work.

                                  When i make a lib for QUAZIP and than i link it to my lib it will work.

                                  Now i do so, but have you an Idea why it to not work when i include the QUAZIP Files?

                                  lg Chris

                                  kshegunovK Offline
                                  kshegunovK Offline
                                  kshegunov
                                  Moderators
                                  wrote on last edited by
                                  #16

                                  @ckvsoft said in Low Level Plugins:

                                  Now i do so, but have you an Idea why it to not work when i include the QUAZIP Files?

                                  What are those files you include, and what are the exact linker errors?

                                  Read and abide by the Qt Code of Conduct

                                  C 1 Reply Last reply
                                  0
                                  • kshegunovK kshegunov

                                    @ckvsoft said in Low Level Plugins:

                                    Now i do so, but have you an Idea why it to not work when i include the QUAZIP Files?

                                    What are those files you include, and what are the exact linker errors?

                                    C Offline
                                    C Offline
                                    ckvsoft
                                    wrote on last edited by ckvsoft
                                    #17

                                    @kshegunov
                                    The include is the quazip.pri which holds the .h and .cpp files from quazip

                                    The output are the undefined reference to imp__

                                    The complete output i can send you tomorrow.

                                    Thx

                                    1 Reply Last reply
                                    0
                                    • C Offline
                                      C Offline
                                      ckvsoft
                                      wrote on last edited by
                                      #18

                                      I have found the issue :) A typo in the .pro file

                                      I add a .cpp file to the HEADERS and not the .h

                                      Thy to all

                                      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