Skip to content

Conversation

@mikomikotaishi
Copy link

@mikomikotaishi mikomikotaishi commented Nov 22, 2025

This PR proposes C++ module support, for users of C++20 and later who prefer to use modules to access the library rather than headers. This feature is enabled by passing tinyxml2_BUILD_MODULE to CMake, and generates a module tinyxml2, identical to the namespace. I have further updated the README with additional improvements to formatting (such as highlighted blocks).

A previous PR, #1002, proposed C++ modules, however was rejected for including additional build system support beyond CMake (the officially supported build system). It was mentioned that modules are "much more modern" than TinyXML, but this proposal does not increase minimum C++ version required, as the feature is opt-in.

@leethomason
Copy link
Owner

I still don't know about the module thing - I see the use. But the PR does multiple things - updates docs (which seems good, at quick glance), adds a #define for a constant (which doesn't seem necessary), as well as the modules. At the least, this needs to be broken up - start with docs, I think?

@mikomikotaishi
Copy link
Author

OK, I can split this PR into multiple PRs

@mikomikotaishi
Copy link
Author

adds a #define for a constant (which doesn't seem necessary)

The reason this is done is because macros cannot be exported by modules, and must be converted to actual symbols in order to be exportable. The simplest way to be exportable is to make them inlined compile-time constants, which will have external linkage, but this is only necessary for modules.

@mikomikotaishi
Copy link
Author

mikomikotaishi commented Nov 23, 2025

First made a PR updating the README and another for the constants definitions and linkage. After that I'll re-make the modules PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants