This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR2355: how to have a library recognize a #define that exists in an application??

Part Number: MSP430FR2355

I have an executable application project where the user has access in the header file to some #defines.....I then have a separate library project that will get built first then included such that the user can use this.  However the library depends on the #defines in the application.....How do I do this?  I am assuming here that extern only works with variables and functions not constants.  I do have a header file that the user will include to be able to use the library but I wanted to keep that for pretty much viewing only and not have the user 'muck' around inside there....

Thanks

  • As I said before, you need  public and private header files. The library would include both headers, the user only the public one. #defines the user should refer to belong in the public header.

  • Not sure what 'private' means here....The user will have both header files and will be able to view both header files and the best I can hope for is the user is warned NOT to change anything in the private header file as the compiled library will stop working....Is this pretty much what you are suggesting???

    I am still not sure how to proceed.  The #define is a TBxCCRx register load.  I want this to be public NOT private.  Sure I can put it in the library header file but if I am telling the user to 'stay clear' then they lose control over a parameter that I would like them to be able to access.  If I put the #define in the public header then the issue is still how to get that info back into the compiled library so it can load the register......

  • A private header would just be part of the pre-compiled source code the user never sees. A public one has a set of defines and prototypes the user needs to use the library. No changes to the public header file after compile time will have any affect on the library.

    An include file is just code that the file executes. Ask yourself "If I change this in the header file, can it have any effect in my pre-compiled library?

  • Got it....Thanks Keith!

**Attention** This is a public forum