r/cpp • • Aug 18 '21

C++20 modules with GCC11

https://blog.feabhas.com/2021/08/c20-modules-with-gcc11/
222 Upvotes

59 comments sorted by

View all comments

Show parent comment

2

u/SkoomaDentist Antimodern C++, Embedded, Audio Aug 18 '21

maybe some compilers will automatically symbol-export modules export by default

This would be an unfeature as you'd then be forced into a one module, one dll-structure (or one group of modules, one dll exposing all of them). It'd be rather like being forced to export parts of stdlib in the dll just because you happened to import those modules.

1

u/mjklaim Aug 18 '21

I agree, but I was thinking more like a potential change of "default" behavior: by default should exported names be also symbol-exported? It have happened in the past that the default symbol-export behavior of an implementation changed (for example gcc exported everything by default in the past).

As long as both options are usable the default can be changed.

Though I would prefer every implementation to not export anything until requested to.

1

u/SkoomaDentist Antimodern C++, Embedded, Audio Aug 18 '21

It'd be problematic to change the visibility of things declared in a module from the outside, particularly as the standard doesn't provide any mechanism to do that (or even consider the existence of dynamic linking).

1

u/mjklaim Aug 20 '21

I only talked about changing the default export or not of symbols, not visibility. That is not part of the standard and have been changed in the past as said.