From emmanuil.tsagarakis at gmail.com Fri May 20 03:44:35 2022 From: emmanuil.tsagarakis at gmail.com (Emmanuil Tsagarakis) Date: Fri May 20 03:40:46 2022 Subject: [xsd-users] exported types with restrictions, based on xs:string - link time, multiple defined symbols error Message-ID: Hello! Has anyone faced this issue before? I'm developing a program that links with two dynamic libraries. Each library contains one or more xsd schemas. I need to export/import the generated classes from those dlls, so in xsd compiler I use the Export Symbol: --export-symbol "EC3_DLL_DECL" for the first one and --export-symbol "EC5_DLL_DECL" for the second The above export symbols are defined as: #ifdef _EC2DLL #define EC2_DLL_DECL __declspec(dllimport) #else #define EC2_DLL_DECL __declspec(dllexport) #endif and: #ifdef _EC3DLL #define EC3_DLL_DECL __declspec(dllimport) #else #define EC3_DLL_DECL __declspec(dllexport) #endif I add both _EC2DLL and _EC3DLL in my main program C++ preprocessor definitions. Both schemas contain elements with restrictions, based on xs:string like the following: The problem is that, when I link the 2 libs against the main exe program, I get errors for multiple defined symbols, like the following: LibPost.lib(LibPost.dll) : error LNK2005: "public: __cdecl std::basic_string,class std::allocator >::basic_string,class std::allocator >(class std::basic_string,class std::allocator > const &)" (??0?$basic_string@_WU?$char_traits@ _W@std@@V?$allocator@_W@2@@std@@QEAA@AEBV01@@Z) already defined in add_brace_links.obj It seems like for types with restrictions, std::basic_string is exported multiple times from both dlls. Is anyone aware of this issue? Has anyone faced the problem before? Any help or suggestion is highly appreciated! Thank you in advance, Emmanuil From boris at codesynthesis.com Tue May 24 08:53:08 2022 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue May 24 08:48:58 2022 Subject: [xsd-users] exported types with restrictions, based on xs:string - link time, multiple defined symbols error In-Reply-To: References: Message-ID: Emmanuil Tsagarakis writes: > Has anyone faced this issue before? Yes, the latest reply to a similar question (with links to earlier replies/more information) is here: https://codesynthesis.com/pipermail/xsd-users/2021-October/005175.html