[xsd-users] Issue with using xsd generated code in DLLs with Visual
Studio 2010
Timo Geusch
timo.geusch at styleadvisor.com
Thu Sep 16 18:02:11 EDT 2010
I've run into an issue with using XSD-generated code in DLLs that build fine in VS2008 but fail with 'interesting' linker errors in VS2010.
The project I'm working on contains multiple DLLs, several of which contains code that has been generated from XML schemas. Several of the classes generated by XSD are exported for use by code in other DLLs. All of this builds and works fine in VS2008.
It looks like Microsoft did change the implementation of their standard library in VS2010 however, and as a side effect it appears that classes which derive from standard C++ classes like std::basic_string etc trigger an export of their base class's symbols. In other words, the class xsd::cxx::string as defined in cxx/tree/types.hxx results in the DLL exporting most of std::basic_string. Try to link two DLLs that both use and export a generated schema and the build will fail with the linker complaining about duplicate symbols. Please note that in this case it's actually an error and not a warning as you end up trying to link two DLLs that try to export the same symbols.
This appears to be a known issue and there are several discussions about this on Microsoft Developer Center - one of them (with links to others) can be found here:
http://social.msdn.microsoft.com/Forums/en/vclanguage/thread/191de00a-53c9-4bd9-9cb6-e844eb224ca2
Has anybody encountered this issue and if so, are there any suggested workarounds? The obvious one (not exporting the classes) is out as they do need to be accessed from other DLLs.
Many thanks,
Timo
More information about the xsd-users
mailing list