release build causes errors
Hello!
I have set of projects which consist of dynamic library
(lets call it libMain), set of executables (exes) and set of dynamic
libraries (libs).
Both exes and libs use libMain.
Debug build causes no errors.
Release build causes similar errors in libs that looks like:
<one of libs> fatal error LNK1194: cannot delay-load '<libMain>' due
to import of data symbol '"__declspec(dllimport) const
<libMainClass>::`vftable'" (__imp_??_7<libMainClass>@@6B@)'; link
without /DELAYLOAD:<libMain>
<libMainClass> is one of two interface (virtual abstract ) classes declared in libMain this way:
class QTS_EXPORTQTS <libMainClass>
{
public:
virtual ~<libMainClass>() {};
virtual QString text() = 0;
<other virtual funcs just like text()>
};
QTS_EXPORTQTS defined as __declspec(dllexport) when building library and __declspec(dllimport) when linking against it.
Note, release build causes no errors in libMain and exes.
[1099 byte] By [
a550ee] at [2007-11-20 1:38:47]

# 3 Re: release build causes errors
I've compared commands for both compiler and linker. Here are they:
1. debug
compiler
=======
/I "..\libQts" /I "C:\Qt\3.3.4\include"
/I "." /I "C:\Qt\3.3.4\mkspecs\win32-msvc.net"
/D "_WINDOWS" /D "UNICODE" /D "WIN32" /D "QTS_WIN32"
/D "QTS_QTS" /D "QTS_MAKEQTSREPORT"
/D "QT_DLL" /D "QT_THREAD_SUPPORT" /D "_WINDLL"
/Gm /MDd /GR /Fo".\\" /Fd".\\" /W3 /nologo /c /Zi /TP
linker
======
/OUT:"..\..\lib\QtsReport.dll" /NOLOGO /LIBPATH:"../../lib"
/LIBPATH:"C:\Qt\3.3.4\lib" /DLL /DELAYLOAD:"Qts.dll"
/DEBUG /SUBSYSTEM:WINDOWS /BASE:"0x39D00000" qt-mt334.lib Qts.lib
delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
imm32.lib winmm.lib wsock32.lib winspool.lib delayimp.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib DelayImp.lib
2.release
compiler
========
/O1 /I "..\libQts" /I "C:\Qt\3.3.4\include"
/I "." /I "C:\Qt\3.3.4\mkspecs\win32-msvc.net"
/D "QT_NO_DEBUG" /D "NDEBUG"
/D "_WINDOWS" /D "UNICODE" /D "WIN32" /D "QTS_WIN32"
/D "QTS_QTS" /D "QTS_MAKEQTSREPORT"
/D "QT_DLL" /D "QT_THREAD_SUPPORT" /D "_WINDLL"
/FD /MD
/GR /Fo".\\" /Fd".\\" /W3 /nologo /c /TP
linker
======
/OUT:"..\..\lib\QtsReport.dll" /NOLOGO /LIBPATH:"../../lib"
/LIBPATH:"C:\Qt\3.3.4\lib" /DLL /DELAYLOAD:"Qts.dll"
/DELAYLOAD:"comdlg32.dll" /DELAYLOAD:"oleaut32.dll" /DELAYLOAD:"winmm.dll" /DELAYLOAD:"wsock32.dll" /DELAYLOAD:"winspool.dll"
/SUBSYSTEM:WINDOWS /BASE:"0x39D00000" qt-mt334.lib Qts.lib
delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
imm32.lib winmm.lib wsock32.lib winspool.lib delayimp.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib DelayImp.lib
Looks pretty similar.
I import dozens of classes from Qts.dll but all release targets fail on only two virtual abstract classes. Moreover, theres "vftable" word in error message. As far as I know its a virtual function table :)
Maybe It somehow related to fact theese two classes are abstract.
a550ee at 2007-11-10 23:19:51 >
