I have one C++ project with settings of Unicode as character set and /clr option for common language run time support. I am calling some function of MFC dll (with setting of MultiByte character set) and I am getting some liking error on those functions which are using wchar_t. Same dll is working file for those unicode c++ projects where /clr option is not set (i.e. no common language run time support). I have done the google and tried some thing like:--
- Replace Cstring with std:string but both are giving same error.
Example for std: string:--
error LNK2001: unresolved external symbol "public: __thiscall CEventLog::CEventLog(wchar_t const *)" (??0CEventLog@@QAE@PB_W@Z)
for Cstring:--
error LNK2019: unresolved external symbol "public: bool __thiscall CIITAdoField::GetValue(class ATL::CStringT > > &)" (?GetValue@CIITAdoField@@QAE_NAAV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z) referenced in function "public: bool __thiscall Iit::DataFeedSvr::SpeedCache::CacheLoader > >,class Iit::DataFeedSvr::SpeedCache::HolidayScheduleInfo,struct Iit::DataFeedSvr::SpeedCache::HolidayScheduleSpeedCacheParam>
::Reload(class Iit::DataFeedSvr::SpeedCache::DoubleKeyCacheInstance > >,class Iit::DataFeedSvr::SpeedCache::HolidayScheduleInfo,struct Iit::DataFeedSvr::SpeedCache::HolidayScheduleSpeedCacheParam> &,class CIITAdoRecordset &,enum Iit::DataFeedSvr::SpeedCache::ERefreshType,class Iit::DataFeedSvr::SpeedCache::CacheObserver const *)" (?Reload@?$CacheLoader@V?$DoubleKeyCacheInstance@JV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@VHolidayScheduleInfo@SpeedCache@DataFeedSvr@Iit@@UHolidayScheduleSpeedCacheParam@456@@SpeedCache@DataFeedSvr@Iit@@@SpeedCache@DataFeedSvr@Iit@@QAE_NAAV?$DoubleKeyCacheInstance@JV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@VHolidayScheduleInfo@SpeedCache@DataFeedSvr@Iit@@UHolidayScheduleSpeedCacheParam@456@@234@AAVCIITAdoRecordset@@W4ERefreshType@234@PBVCacheObserver@234@@Z)
- I have checked the setting like "Treat Wchar_t as Built in type" and it is file.
- I have tried to explicitly export function and class using
__declspec(dllexport)but no luck. - I can not change my project from unicode to multibyte or can not change the setting of /clr option as it starts giving other error.
Please suggest the solution. Thanks in advance.