Ah, I think I'm starting to get it, using ->resolve incorrectly! Reading up on function pointers
While reading on function pointer is certainly good, I'd like to point out that this is not the usual way shared libs are used, even-though, its one way to use them - however, it is very cumbersome, whats more, if your libs get extended, you will have to edit your code that extract the functions from your DLL - so not that recommended for regular cases.
Usually you specify in your build configuration (I suppose you use qmake in this case, so it will be the LIBS qmake variable) which libs (DLLs) you are linking to, and the linker does the job for you.
In your code all you have to do is to include the correct header files, and simply use the classes and functions from your DLL as if they where part of your application's code.
So your main.cpp would look like this:
#include <mydll.h> //provided mydll.h is in your header search path, othewize you need to specify it with "path/to/mydll.h"
int main(int argc, char *argv[])
{
HelloWorld();
}
#include <mydll.h> //provided mydll.h is in your header search path, othewize you need to specify it with "path/to/mydll.h"
int main(int argc, char *argv[])
{
HelloWorld();
}
To copy to clipboard, switch view to plain text mode
and in your *.pro file you would add:
INCLUDEPATH += -I/path/to/mydll/headers
LIBS += -L/path/to/mydll -lmydll //note -L for seachpatth and -l for the lib itself
INCLUDEPATH += -I/path/to/mydll/headers
LIBS += -L/path/to/mydll -lmydll //note -L for seachpatth and -l for the lib itself
To copy to clipboard, switch view to plain text mode
qmake docs might be of help:
http://doc.qt.io/qt-5/qmake-variable-reference.html
Bookmarks