Skip to content

Commit

Permalink
Add config flag to enable/disable adding codal to the global namespac…
Browse files Browse the repository at this point in the history
…e. (#171)

Flag mostly to be used in other CODAL libraries/targets.

This is part of:
lancaster-university/codal-microbit-v2#240

As removing 'using namespace codal' from codal-nrf52 can break
a few targets, this patch adds a CODAL flag/macro to enable/disable
its usage.
  • Loading branch information
microbit-carlos authored Jul 24, 2024
1 parent d91a97c commit 509086c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions inc/core/CodalConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,15 @@ DEALINGS IN THE SOFTWARE.
#define CODAL_STREAM_IDLE_TIMEOUT_MS 75
#endif

// During early CODAL development there was some misuse of `using namespace codal;` in header files.
// Removing it from CODAL libs can cause targets to break unless they apply a large patch like:
// https://github.com/lancaster-university/codal-microbit-v2/pull/437
// This global namespace can be a problem when using CODAL together with other libraries/frameworks.
// So we can use this flag to enable/disable whether to use the codal namespace globally or not.
#ifndef CODAL_USE_GLOBAL_NAMESPACE
#define CODAL_USE_GLOBAL_NAMESPACE 1
#endif

//
// Helper macro used by the codal device runtime to determine if a boolean configuration option is set.
//
Expand Down

0 comments on commit 509086c

Please sign in to comment.