Hi
Sorry to say, but I cannot get your problem.
But for using a dll, move all the dll source files to 1 project, create a pro file that creates a lib.
include the .h file in the application that you want to use the dll in.
use QLibrary to load the dll. (dynamic linking).
make sure to put Q_DECL_EXPORT when you compile as library on your class and Q_DECL_IMPORT when you include the header file in your application.
something like this:
mylibrary.pro
CONFIG += dll
DEFINES += COMPILING_LIBRARY
#then comes your sources and headers... remember to add LIBS += mylibrary.lib in your application pro file
CONFIG += dll
DEFINES += COMPILING_LIBRARY
#then comes your sources and headers... remember to add LIBS += mylibrary.lib in your application pro file
To copy to clipboard, switch view to plain text mode
mylibrary.h
#ifdef COMPILING_LIBRARY
#define MYLIBRARYEXPORT Q_DECL_EXPORT
#else
#define MYLIBRARYEXPORT Q_DECL_IMPORT
#endif
class QFD_USB_LIB_EXPORT MyLibraryInDLL
: public QWidget{
Q_OBJECT
public:
}
#ifdef COMPILING_LIBRARY
#define MYLIBRARYEXPORT Q_DECL_EXPORT
#else
#define MYLIBRARYEXPORT Q_DECL_IMPORT
#endif
class QFD_USB_LIB_EXPORT MyLibraryInDLL: public QWidget
{
Q_OBJECT
public:
MyLibraryInDLL(QWidget *parent);
}
To copy to clipboard, switch view to plain text mode
myapplication.cpp
#include "mylibrary.h"
loadmylibrary
->setLoadHints
(QLibrary::ResolveAllSymbolsHint);
loadmylibrary->load();
if (loadmylibrary->isLoaded() == false)
{
// error didn't load... do something!
}
#include "mylibrary.h"
QLibrary *loadmylibrary = new QLibrary("mylibrary", this);
loadmylibrary->setLoadHints(QLibrary::ResolveAllSymbolsHint);
loadmylibrary->load();
if (loadmylibrary->isLoaded() == false)
{
// error didn't load... do something!
}
To copy to clipboard, switch view to plain text mode
cheers,
Leif
Bookmarks