Skip to content

Commit

Permalink
Optionally attach declarations to the global module rather than `mo…
Browse files Browse the repository at this point in the history
…dule fmt`

This allows coexistence with TUs that use {fmt} through #include without duplicating declarations, definitions, linker symbols, and object code.
  • Loading branch information
DanielaE committed Apr 18, 2023
1 parent 0489c19 commit 56d0049
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/fmt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export module fmt;
export {
// All library-provided declarations and definitions must be in the module
// purview to be exported.
#ifdef FMT_ATTACH_TO_GLOBAL_MODULE
extern "C++" {
#endif

#include "fmt/args.h"
#include "fmt/chrono.h"
#include "fmt/color.h"
Expand All @@ -83,6 +87,10 @@ export module fmt;
#include "fmt/xchar.h"
#include "fmt/std.h"

#ifdef FMT_ATTACH_TO_GLOBAL_MODULE
}
#endif

// gcc doesn't yet implement private module fragments
#if !FMT_GCC_VERSION
module : private;
Expand Down

0 comments on commit 56d0049

Please sign in to comment.