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

Boris Kolpackov boris at codesynthesis.com
Tue Oct 23 10:12:10 EDT 2007


Hi Shaun,

Shaun Mangelsdorf <s.mangelsdorf at gmail.com> writes:

> c:\xsd\libxsd\xsd\cxx\tree\buffer.txx(97) : error C2064: term does not
> evaluate to a function taking 2 arguments
>
> After taking a look at this file, I changed the line from:
>           capacity_ (other.capacity_, false);
> to:
>           capacity (other.capacity_, false);
> and this compilation error went away.
>
> I then checked XSD 3.0.0 and noticed that this is already changed in this
> version, so perhaps this is a known and fixed bug :)

Yes, this is a know bug that has been fixed in 3.0.0.


> c:\xsd\libxsd\xsd\cxx\tree\containers.hxx(932) : error C2248:
> 'xsd::cxx::tree::uri<C,B>::uri' : cannot access protected member
>
> Perhaps an obvious fix here, I changed the visibility on the default
> constructor for xsd::cxx::tree::uri ( types.hxx:1187) to public. Got rid of
> the error message but this still leads me to think there is a problem with
> the way this is being used.

Yes, this is not an ideal fix. A better one would probably be to merge
the two constructors (this and the next one) in containers to be:

sequence (size_type n, const X& x = X ())
  : sequence_common (n, x)
{
}

It used to be like this but then it caused problems on IBM XL C++[1].
Could you make the above change and let me know if it helps? If it
does, then I can add some macro hackery to make it work on both VC++
and XL C++.

> My theory is that G++ doesn't see it because it's never used, and so
> it's not compiled, but MSVC compiles the whole template class.

I think I know what happens: when you export a type, VC++ for some
(perhaps valid, from its DLL architecture point of view) reason
instantiates things that aren't directly used. That's why when
you remove the DLL export macro, everything compiles. Of course,
this is a violation of the C++ Standard which says that only
functions that are used should be instantiated.

Thanks for reporting this!

Boris

[1] http://codesynthesis.com/~boris/blog/2006/12/06/default-argument-or-overloading/




More information about the xsd-users mailing list