How to send the main program programming directive to some library?

Asked

Viewed 36 times

0

I have a library that generates a result of two allowed. This is given by the definition, within the library itself, of the directives #define __SE8R01__ or #define __RF24L01P__.

The case is that this choice should be made within the main programme. However I am not getting alternative to this, leaving the obligation to "move" in the original state of the library.

The question is how to send some directive from the main program, main(), for any library in use. Or some alternative, so that the library when compiled recognizes the appropriate directive?

  • Pre-processing directives are only available at the compilation level. If you don’t have control over the library build, you won’t be able to do what you want with a simple #define. I speak a little more details of the C compilation process in this answer

  • Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful for you. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).

1 answer

1

Compiler directives indicate to the compiler how it should behave in several situations, so the only way to change its value is at the time of compiling the library used, if it does not have the sources or cannot compile itla then nothing can be done to change the behavior of the library in question.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.