Solved Low Level Plugins
-
@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)
-
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
-
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 ?
-
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
-
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 :)
-
Hi
Sorry not cashregister. Receipt is the right one ;-) -
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
-
@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
-
As @kshegunov wrote, you didn't properly export your library's symbols. Take a look at the Creating Shared Libraries in Qt's documentation.
-
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 ClassBy 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.
-
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.
-
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
-
@ckvsoft No, just export the class
-
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
-
@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?
-
@kshegunov
The include is the quazip.pri which holds the .h and .cpp files from quazipThe output are the undefined reference to imp__
The complete output i can send you tomorrow.
Thx
-
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