CString in static library for both MFC and non-MFC projects
-
As much as I understand: Non-MFC projects / Projects with ATL support use CString via
atlstr.h
MFC projects use CString viacstringt.h
They are source-code compatible, bbut not link time compatible; so if I have a static library that does useCString
and that I want to use in both an MFC and a non-MFC project, I have to build the library in two configurations - with / without MFC support. Is there any sane way to build the library and link it to both MFC and non-MFC projects? -
As much as I understand: Non-MFC projects / Projects with ATL support use CString via
atlstr.h
MFC projects use CString viacstringt.h
They are source-code compatible, bbut not link time compatible; so if I have a static library that does useCString
and that I want to use in both an MFC and a non-MFC project, I have to build the library in two configurations - with / without MFC support. Is there any sane way to build the library and link it to both MFC and non-MFC projects?Remove the CString dependency (i.e. use std::string or something else)... as easy CString is to use, they sure jumbled things up by essentially including it in two places (which is what I assume the link time portion means). Now, I am assuming that's what they mean by "not being link-time compatible" means. You can verify by using a tools to look for the CString symbols in either library (in linux you'd use the "nm" utility, there must be a Windows equivalent but not sure of the name).