This is in continuation for the thread "Unresolved external symbol error occurring only in 64-bit mode and not in 32-bit build" .
I have a VC++ code (built using VS2008), which makes use of some static libraries (*.lib files linked statically during compile time).
For ease of understanding let's refer my EXE code as "AAA.EXE" & refer the lib files as "A.lib", b.lib and LOGGER.lib (the library which is causing the below error)
Both the AAA.EXE code and static libraries code (LOgger.lib) are built using VS2008.
I see that my "AAA.EXE" is working fine in 32-bit version but showing the below linker errors when AAA.EXE is built in 64-bit mode.
Again copying the linker error for quick reference:
Logger.lib(Logger.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CWTTLogger::CWTTLogger(void)" (__imp_??0CWTTLogger@@QAE@XZ)
1>Logger.lib(Logger.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall CWTTLogger::~CWTTLogger(void)" (__imp_??1CWTTLogger@@UAE@XZ)
1>Logger.lib(Logger.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: long __thiscall CWTTLogger::CreateLogDevice(unsigned short *,long *)" (__imp_?CreateLogDevice@CWTTLogger@@QAEJPAGPAJ@Z)
1>Logger.lib(Logger.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: long __thiscall CWTTLogger::StartTest(unsigned short *,long)" (__imp_?StartTest@CWTTLogger@@QAEJPAGJ@Z)
1>Logger.lib(Logger.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: long __thiscall CWTTLogger::EndTest(unsigned short *,unsigned long,unsigned short *,long)" (__imp_?EndTest@CWTTLogger@@QAEJPAGK0J@Z)
1>Logger.lib(Logger.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: long __cdecl CWTTLogger::Trace(unsigned long,long,...)" (__imp_?Trace@CWTTLogger@@QAAJKJZZ)
1>Logger.lib(Logger.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: long __thiscall CWTTLogger::CloseLogDevice(unsigned short *,long)" (__imp_?CloseLogDevice@CWTTLogger@@QAEJPAGJ@Z)
1>C:\Users\User1\Documents\XYZ\Code\64bit\aaa.exe: fatal error LNK1120: 7 unresolved externals
Here, CWTTLOgger is the class from Microsoft provided header file "wttlogger.h".
Logger.lib is my custom library where I'm using the Microsoft WTTLog.DLL and the header file corresponding to it "wttlogger.h".
I have figured out the root cause for this linker error. The Logger.lib static library code makes use of Microsoft WTTLog.DLL by calling the function in this WTTLog.DLL from the header file "wttlogger.h".
Now these calls when called in 32-bit AAA.exe (linked to Logger.lib static library) are working fine (NO linker errors). But when 64-bit AAA.EXE (linked to 64bit Logger.lib) is calling the functions in WTTLog.DLL it's giving the above linker errors.
It's very clear that the WTTLog.DLL/WTTLog.lib library are not 64-bit or the header file for this library "wttlogger.h" doesn't match with the library definition.
I did find the WTTLog.DLL for 64-bit in Windows DDK in "C:\WinDDK\Win8-RTM\Tools\x64\WTTlog.dll". Please correct me if I'm wrong.
But where do I find the header file corresponding to this 64bit Wttlog.DLL and the static library corresponding to this DLL "WTTLog.DLL". ??