Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow different name for namespace #273

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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