PDA

View Full Version : Export Qt stuff from DLL goes wrong



RThaden
28th March 2008, 18:40
Hi all,

I made a DLL which worked fine until I integrated some Qt stuff.
Now, it compiles fine, but some methods are not found inside the DLL, namely those which use Qt (e.g. have a QList as return value).
I read a bit about exporting Qt in a DLL but don't find my error.
I use
qmake -project -t vclib
qmake -tp vc
to generate a vc2005 project and then compile.
Further, I use


#ifdef HD2COMM_EXPORTS
#define HD2COMM_API Q_DECL_EXPORT //__declspec(dllexport)
#define EXPIMP_TEMPLATE
#else
#define HD2COMM_API Q_DECL_IMPORT //__declspec(dllimport)

with HD2COMM_EXPORTS defined

in my header file.
Preprocessor definitions are
_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL ,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT

When I look at the DLL with the dependency walker, I find that e.g. these functions


class QList<class CHD2Input *> CRoutingManager::GetListInputs(void)
class QList<class CHD2Output *> CRoutingManager::GetListOutputs(void)

are not available whereas others are. However, I don't get any link error.
But when I start the application which uses the DLL, I get a message, that a function is not found in the DLL.

Any help is appreciated.

Thanks in advance,

Rainer

jpn
29th March 2008, 22:09
Did you include <QtGlobal> or any other Qt header in the file which defines HD2COMM_API?