In the latest version of STLPort some bright spark (with a unix background) has decided to 'rationalise' the naming of the output libraries so that they're called the same thing on all platforms. This is, probably, a noble cause but unfortuantely it means that they decided to remove the compiler name from the library name. Previously you'd end up with names like
stlport_vc646.dll; note the
vc6 in there... Now, you end up with
stlport.5.0.dll which is slightly prettier but useless if you want to have a single STLPort installation for multiple installed versions of Visual C++. Various reasons may mean that the libraries are not link compatible between compiler versions. VC uses a typedef to create a
wchar_t whereas VC7, VC7.1 and VC8 allow it to be a real type and VC8 defaults to this new behaviour; this affects name mangling and this prevents linkage between VC8 and VC6 compiled code (unless you disable the real
wchar_t in VC8 and I don't want to do that...).
You can use the
configure script to set the build system up for building "cross compiled versions" using
-x but this just puts the output in separate directories so that you can build multiple versions on one machine, this doesn't help me.
The fix is relatively easy, you need to edit
Makefile.inc and change this line:
LIBNAME = stlport
LIBNAME = stlport_$(COMPILER_NAME)
That change builds the library with the compiler name included in the output name. Next you need to change the header file that generates the
#pragma that auto links the library for you. Edit
stl_msvc.h and find this line:
# define _STLP_STLPORT_LIB "stlport"_STLP_LIB_OPTIM_MODE""_STLP_LIB_TYPE"."_STLP_VERSION_STR".lib"and change it to
// Start LFH // Put back the useful, working code from pre 5.0.0 that allows coexistance of multiple VC version builds of // STLPort, and add a case for VC8 # ifdef __ICL # define _STLP_LIB_BASENAME "stlport_icl" # else # if (_MSC_VER >= 1400) # define _STLP_LIB_BASENAME "stlport_vc8" # elif (_MSC_VER >= 1310) # define _STLP_LIB_BASENAME "stlport_vc71" # elif (_MSC_VER >= 1300) # define _STLP_LIB_BASENAME "stlport_vc70" # elif (_MSC_VER >= 1200) //# ifdef _UNICODE //# define _STLP_LIB_BASENAME "stlport_vc6_unicode" //# else # define _STLP_LIB_BASENAME "stlport_vc6" //# endif # elif (_MSC_VER >= 1100) //# ifdef _UNICODE //# define _STLP_LIB_BASENAME "stlport_vc5_unicode" //# else # define _STLP_LIB_BASENAME "stlport_vc5" //# endif # endif /* (_MSC_VER >= 1200) */ # endif /* __ICL */ // end LFH # define _STLP_STLPORT_LIB _STLP_LIB_BASENAME""_STLP_LIB_OPTIM_MODE""_STLP_LIB_TYPE"."_STLP_VERSION_STR".lib"
There's probably a better way to do this, but this works for me, it might work for you.
The changed files are here (mainly as a convenience for me for when I happen to reinstall and get all confused...)