[Ext] Re: [xsd-users] DLLs and --generate-element-type --generate-element-map

Nicolas Weidmann n.weidmann at lombardodier.com
Tue Jun 30 10:21:16 EDT 2026


Hello Boris,

Thanks for your help !

I have 1 common lib and different libs for each data-binding.

I am correctly building the common lib as a DLL with regards to my own custom classes.
But I forgot to use --export-symbol for generating the xml-schema header...

I use --export-symbol for the different data-bindings DLLs, but completely forgot about the common lib...

I am working on another task this week.

I will give you a feedback ASAP next week.

Regards,


Nicolas Weidmann
Banque Lombard Odier & Cie SA
Rue de la Corraterie 11 - 1204 Genève - Suisse
T +41 22 709 23 17
www.lombardodier.com
-----Original Message-----
From: Boris Kolpackov <boris at codesynthesis.com>
Sent: mardi, 30 juin 2026 16:11
To: Nicolas Weidmann <n.weidmann at lombardodier.com>
Cc: xsd-users at codesynthesis.com
Subject: [Ext] Re: [xsd-users] DLLs and --generate-element-type --generate-element-map

Nicolas Weidmann <n.weidmann at lombardodier.com> writes:

> I wanted to use --generate-element-type --generate-element-map in
> order to have a single parse & serialize as our code heavily relies
> on templates and parseMyType, etc. are not generic.
>
> It works fine as long as all the libs are static, but I need to have
> the different data-binding libraries to be DLLs.
>
> In that case, it fails as the different dlls have their own element
> map and the application code has its own, empty, element map.
>
> Do I have to implement my own --custom-type for the element map?

No, the overall approach is to have a "root" DLL that exports the
single map that everyone else imports. The element map is a class
template (with a static data member which is the actual map) and
exporting templates from DLLs is a murky business. If you want
to give it a go, the starting point would be to generate the
header for XML Schema built-in types (which includes the
element_map) and export it from your root DLL. Something along
these lines:

xsd cxx-tree \
  --generate-element-map \
  --generate-element-type \
  --export-xml-schema \
  --export-symbol XML_SCHEMA_EXPORT \
  --generate-xml-schema  \
  xml-schema.xsd

You would need to define XML_SCHEMA_EXPORT appropriately. You will also
need to have this header included in at least one source file that belongs
to the root DLL in order to have the template instantiations exported.

Once this is done, all your actual schemas would be compiled with
--extern-xml-schema in order to use this shared header.
[[ rethink everything. ]]<https://www.lombardodier.com>

[[LinkedIn]]<https://www.linkedin.com/company/lombard-odier>  [[Twitter]] <https://twitter.com/lombardodier>   [[Facebook]] <https://facebook.com/lombardodier>   [[Instagram]] <https://www.instagram.com/lombardodier/>   [[YouTube]] <https://www.youtube.com/channel/UCqatbeqXskmWejbm0KPLV3w>

*** IMPORTANT NOTICE REGARDING INSTRUCTIONS by EMAIL ***
Please be aware that instructions received by e-mail should be
considered delayed and not executed unless they have been
specifically confirmed by your relationship manager/banker.
Email traffic during turbulent times in the financial markets is
high and cannot always be acted upon at all times.
Lombard Odier cannot be held liable for such delay in execution
or for the non-execution of an instruction given by email even
if it was given in due time. Therefore, instructions requiring
immediate action must be communicated by telephone by calling
the bank’s registered landline.
Thank you for your understanding.

*** IMPORTANT INFORMATION ABOUT DATA PROTECTION ***
You might be receiving this because you have provided us with
your contact details. If this is the case note that we may process
your personal data for direct marketing purposes.
If you wish to object to this processing, please notify the
Group’s Data Protection Officer<mailto:group-dataprotection at lombardodier.com>.
For more information: www.lombardodier.com/privacy-policy

DISCLAIMER **********************************************
This message is intended only for use by the person
to whom it is addressed. It may contain information
that is privileged and confidential. Its content does
not constitute a formal commitment by any company
of the Lombard Odier group. If you are not the intended
recipient of this message, kindly notify the sender
immediately and destroy this message. Thank You.
*******************************************************(dch)*




More information about the xsd-users mailing list