[xsd-users] Compiling to multiple DLLs, duplicate symbols problem

Greg Carter greg at permedia.ca
Fri Nov 20 12:46:14 EST 2009


Hello Boris,

Unfortunately this problem seems to have exposed itself again.  I 
recently upgraded to VS 2008 SP1 (I was using 2005 previously).  When I 
upgraded and rebuilt everything went OK.  Today I moved one XSD file 
(and the corresponding .cxx/hxx)  from my dependant dll into my base dll 
project.  Did a clean/rebuild on both and when I attempt to link the 
dependant dll I get the duplicate symbols problem:

1>geocosmxmllibbasecpp.lib(geocosmxmllibbasecpp.dll) : error LNK2005: 
"public: class xsd::cxx::tree::sequence<int,1> & __thiscall 
xsd::cxx::tree::sequence<int,1>::operator=(class 
xsd::cxx::tree::sequence<int,1> const &)" 
(??4?$sequence at H$00 at tree@cxx at xsd@@QAEAAV0123 at ABV0123@@Z) already defined 
in Compaction_custom.obj
1>geocosmxmllibbasecpp.lib(geocosmxmllibbasecpp.dll) : error LNK2005: 
"public: __thiscall 
xsd::cxx::tree::sequence<int,1>::~sequence<int,1>(void)" 
(??1?$sequence at H$00 at tree@cxx at xsd@@QAE at XZ) already defined in 
Illite_custom.obj

If I build in release mode the link error goes away.  In the above error 
message the Compaction_custom and Illite_custom are in the dependant dll 
being linked, geocosmxmllibbasecpp.dll is the base dll.  What is odd is 
that the XSD file I moved is not even referenced by either of the two 
files that trigger the duplicate symbol error.  I've double checked that 
the options passed to the file I moved are correct.  Have done multiple 
cleans/manual deletes, no luck.  I'm using version 
xsd-3.3.0.a5-i686-windows.

Any ideas?
I could probably package the projects up if you needed to see the error 
first hand.
Greg.

Greg Carter wrote:
> Hello Boris,
>
> That did the trick.  I did need to add the -hxx-prologue option but I 
> guess that is implied with the --export-symbol option.
>
> Thanks!
> Greg.
>
> Boris Kolpackov wrote:
>> Hi Greg,
>>
>>
>> The solution for this problem is to export symbols for the built-in 
>> types from the "base" DLL and import them in all dependant DLLs and 
>> executables.
>> To automate this we added a new option, --export-xml-schema, for the 
>> next
>> release of XSD. You can give it a try by downloading this pre-release
>> binary:
>>
>> http://www.codesynthesis.com/~boris/tmp/xsd-3.3.0.a5-i686-windows.zip
>>
>> In your case, you will need to add
>> --export-xml-schema --export-symbol GEOCOSMXMLBASE_SYMBOL_DECL
>>
>> when generating the code for the XML Schema namespace (i.e., "compiling"
>> XSDBaseXmlSchema.xsd).
>>
>> Let me know if this works for you.
>>
>> Boris
>>
>>   
>



More information about the xsd-users mailing list