[xsd-users] Problems linking Code which uses XSD in Release mode

Jan Klimke jan.klimke at hpi.uni-potsdam.de
Wed Nov 5 11:57:23 EST 2008


Hi Boris,

i tried several settings and a bit different code, but nothing of that
provoked the faulty linkage. Because a similar problem appereared when i
customized my generated classes like described in the complex example. I
solved the problem vor now by editing the generated header file
containing the xml_schema definitions.

No export symbols were generated inside the whole file. Which caused for
some reason the linker to exclude those template instanciation from
beeing exported.

I changed the following files by instanciating the template classes
(WFS_API defines dll_export and import depending on compile mode):

template class WFS_API ::xsd::cxx::tree::ncname< char, Name >;
typedef ::xsd::cxx::tree::ncname< char, Name > Ncname;

template class WFS_API ::xsd::cxx::tree::qname< char, SimpleType, Uri,
Ncname >;
  typedef ::xsd::cxx::tree::qname< char, SimpleType, Uri, Ncname > Qname;

For other types this does not seem to be a problem at all (like
Exception or UnexpectedElement).

Thank you for your help,
Jan


Boris Kolpackov schrieb:
> Hi Jan,
>
> Jan Klimke <jan.klimke at hpi.uni-potsdam.de> writes:
>
>   
>> I found out that the usage of the Qname Type causes the linker error.
>> When i am using a line like this:
>> xml_schema::Qname("coll:UriComment")
>> Outside the DLL which contains the generated code the mentioned linker
>> error occurs. When using these classes inside the library everything
>> works fine.
>>     
>
> I tried to reproduce this with a test case but had no luck so far.
> Could you try it and see if you get any errors? The test case is
> here:
>
> http://www.codesynthesis.com/~boris/tmp/dlltest.zip
>
> It includes project/solution files for VC++ 8. It also uses the
> rules files that are shipped with XSD for compiling the schema
> so you may need to add a few paths in the VC++ IDE as described
> here:
>
> http://wiki.codesynthesis.com/Using_XSD_with_Microsoft_Visual_Studio#Visual_Studio_2005_.288.0.29_and_2008_.289.0.29
>
> The test is based on the library example. I've added a QName
> attribute to the schema (DLL) as well as an instantiation of
> xml_schema::qname object in the driver (executable).
>
> If you don't get any errors either then you can try to figure
> out what is different between the test and your project. If
> you manage to reproduce the error in the test case, please
> let me know.
>
> Boris
>   




More information about the xsd-users mailing list