Sorry... my bad!
should be like this:
mylibrary.h
#ifdef COMPILING_LIBRARY
#define MYLIBRARYEXPORT Q_DECL_EXPORT
#else
#define MYLIBRARYEXPORT Q_DECL_IMPORT
#endif
class MYLIBRARYEXPORT MyLibraryInDLL
: public QWidget{
Q_OBJECT
public:
}
#ifdef COMPILING_LIBRARY
#define MYLIBRARYEXPORT Q_DECL_EXPORT
#else
#define MYLIBRARYEXPORT Q_DECL_IMPORT
#endif
class MYLIBRARYEXPORT MyLibraryInDLL: public QWidget
{
Q_OBJECT
public:
MyLibraryInDLL(QWidget *parent);
}
To copy to clipboard, switch view to plain text mode
The only reason to load it is if you want to make sure it's loaded before calling a function. As that makes you able to handle a loading-library-error... If not, your app will just crash if there is a problem loading the library. (e.g. the user moved it).
As you say, you don't have to move the files. It was just a suggestion to keep projects like:
Application
--- library1
--- library2
--- library3
--- library3a
--- library3b
Just to make it easier for your self if the projects grows and gets big...
As for the LIBS += mylibrary.lib in the pro file, it's to make the linker find any links to the library. Nothing else...
cheers,
Leif
Bookmarks