Skip to content

Conversation

modularev
Copy link

No description provided.

@franky47
Copy link
Member

How would that work in practice?

A #define MIDI_NAMESPACE foo before including MIDI.h would only apply to the current compilation unit, and not to MIDI.cpp for example.

If you're thinking of defining it as a compiler flag (which would apply everywhere), could you add documentation on how to proceed?

@modularev
Copy link
Author

I did not think of that.. I am working on a project which depends on another class named midi - I think in my case it seems having done the trick - although I certainly need to read up on the usage of namespace...

adding a compiler flag would certainly be possible. However, would you have another in-code solution in mind?

@franky47
Copy link
Member

franky47 commented Mar 2, 2022

Your suggestion could work in combination with a platform.local.txt, an undocumented override to the Arduino compiler, which could set the value of MIDI_NAMESPACE as a preprocessor flag:

compiler.cpreprocessor.flags=-DMIDI_NAMESPACE=mycustommidinamespace

arduino/Arduino#3371
https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html

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