[xsd-users] XSD 2.3.1 export symbols problem with MSVC 8.0

Shaun Mangelsdorf s.mangelsdorf at gmail.com
Mon Oct 22 21:10:53 EDT 2007


Hi xsd-users,

I'm in the process at the moment of porting the SAML2 library from
esoeproject.org to compile as a Win32 .DLL file. I am stuck with XSD
2.3.1at the moment, but if this is an issue that
3.0 will fix I could look into refactoring the code to work with the newer
version. The commands we are currently using to generate the cxx-tree code
is as follows:

    $(XSD) cxx-tree --export-symbol SAML2EXPORT --hxx-prologue '#include
"saml2/SAML2Defs.h"' --char-type wchar_t --generate-xml-schema --custom-type
date --custom-type dateTime --hxx-epilogue '#include "saml2/xsd/xml-
schema-custom.h"' --output-dir $(SAML2PATH)/include/saml2/xsd/
xml-schema.xsd

    $(XSD) cxx-tree --export-symbol SAML2EXPORT --hxx-prologue '#include
"saml2/SAML2Defs.h"' --extern-xml-schema saml2/xsd/xml-
schema.xsd--generate-default-ctor --morph-anonymous --char-type
wchar_t
--generate-polymorphic --generate-serialization --namespace-map
http://www.w3.org/2001/04/xmlenc#=w3::xmlenc
--namespace-map
http://www.w3.org/2000/09/xmldsig#=w3::xmldsig--namespace-map
urn:oasis:names:tc:SAML:
2.0:assertion=saml2::assertion --namespace-map urn:oasis:names:tc:SAML:
2.0:metadata=saml2::metadata --namespace-map urn:oasis:names:tc:SAML:
2.0:protocol=saml2::protocol --output-dir ./src-gen/ $(SAML2PATH)/schema/*

    $(XSD) cxx-tree --export-symbol SAML2EXPORT --hxx-prologue '#include
"saml2/SAML2Defs.h"' --extern-xml-schema saml2/xsd/xml-
schema.xsd--custom-type AttributeValueType --hxx-epilogue '#include
"saml2/xsd/xml-
schema-custom-attributevaluetype.h"' --generate-default-ctor
--morph-anonymous --char-type wchar_t --show-sloc --generate-polymorphic
--generate-serialization --namespace-map
http://www.w3.org/2001/04/xmlenc#=w3::xmlenc --namespace-map
http://www.w3.org/2000/09/xmldsig#=w3::xmldsig
--namespace-map
urn:oasis:names:tc:SAML:2.0:assertion=saml2::assertion--namespace-map
urn:oasis:names:tc:SAML:
2.0:metadata=saml2::metadata --namespace-map urn:oasis:names:tc:SAML:
2.0:protocol=saml2::protocol --output-dir ./src-gen/
$(SAML2PATH)/schema/lxacml- schema-context.xsd


In the case of building the library saml2/SAML2Defs.h defines the
SAML2EXPORT symbol to:
Win32: __declspec(dllexport)
GNU G++: __attribute((visibility("default")))
(Note: on G++ I am compiling with -fvisibility=hidden but that is beside the
point)

The G++ compilation on linux and windows (mingw32) succeeds perfectly, but
on MS Visual C++ (8.0, express edition) I get a list of compiler errors. The
most significant lines are:

c:\xsd\libxsd\xsd\cxx\tree\buffer.txx(97) : error C2064: term does not
evaluate to a function taking 2 arguments
        c:\xsd\libxsd\xsd\cxx\tree\buffer.txx(94) : while compiling class
template member function 'xsd::cxx::tree::buffer<C>
&xsd::cxx::tree::buffer<C>::operator =(const xsd::cxx::tree::buffer<C> &)'
        with
        [
            C=wchar_t
        ]
        c:\xsd\libxsd\xsd\cxx\tree\types.hxx(1268) : see reference to class
template instantiation 'xsd::cxx::tree::buffer<C>' being compiled
        with
        [
            C=wchar_t
        ]
        z:\workspaces\esoe\saml2cpp\include\saml2\bindings\xmldsig-
core-schema.hxx(92) : see reference to class template instantiation
'xsd::cxx::tree::base64_binary<C,B>' being compiled
        with
        [
            C=wchar_t,
            B=xml_schema::simple_type
        ]


c:\xsd\libxsd\xsd\cxx\tree\containers.hxx(932) : error C2248:
'xsd::cxx::tree::uri<C,B>::uri' : cannot access protected member declared in
class 'xsd::cxx::tree::uri<C,B>'
        with
        [
            C=wchar_t,
            B=xml_schema::simple_type
        ]
        c:\xsd\libxsd\xsd\cxx\tree\types.hxx(1188) : see declaration of
'xsd::cxx::tree::uri<C,B>::uri'
        with
        [
            C=wchar_t,
            B=xml_schema::simple_type
        ]
        c:\xsd\libxsd\xsd\cxx\tree\containers.hxx(932) : while compiling
class template member function
'xsd::cxx::tree::sequence<X>::sequence(xsd::cxx::tree::sequence<X>::size_type)'

        with
        [
            X=saml2::assertion::AudienceRestrictionType::Audience::type
        ]
        z:\workspaces\esoe\saml2cpp\include\saml2\bindings\saml-
schema-assertion-2.0.hxx(1437) : see reference to class template
instantiation 'xsd::cxx::tree::sequence<X>' being compiled
        with
        [
            X=saml2::assertion::AudienceRestrictionType::Audience::type
        ]

(apologies for the length of the paste, MSVC++ has some lengthy output.)
Full build output is at http://xsd.pastebin.com/m477292bb until 22 Nov 07.

I have tried changing the export symbol argument to:
--export-symbol '__declspec(dllexport)'
and have also tried removing the --hxx-prologue with that export symbol
included, and I have had no success getting it to build.

Removing the --export-symbol flag entirely fixes it (with obvious bad side
effects), even if the --hxx-prologue flag to include SAML2Defs.h is still
present.

Any idea what steps I could take to resolve this?

Some links that might help:
Schemas:
http://svn.intient.com/websvn/listing.php?repname=esoe&path=%2Fbranches%2Fdevelopment%2Fsaml2cpp%2Fschema%2F#_branches_development_saml2cpp_schema_
*.hxx:
http://svn.intient.com/websvn/listing.php?repname=esoe&path=%2Fbranches%2Fdevelopment%2Fsaml2cpp%2Finclude%2Fsaml2%2Fbindings%2F#_branches_development_saml2cpp_include_saml2_bindings_
*.cxx:
http://svn.intient.com/websvn/listing.php?repname=esoe&path=%2Fbranches%2Fdevelopment%2Fsaml2cpp%2Fsrc%2Fsaml2%2Fbindings%2F#_branches_development_saml2cpp_src_saml2_bindings_



Thanks,
Shaun Mangelsdorf



More information about the xsd-users mailing list