This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Conditional Compiling for a library

in referrence to following code, while generating library, what code would be included? My handler code or user callback function call???

void IRQ_Handler(void)
{
#if MACRO_ENABLED

  // My handler code

#elif

  // User handler callback function

#endif
}

how should i write my code so that both sections are included in the library and the library user gets the power to chose what part he wants to be executed?
i could come up with following solution.


#define MACRO_ENABLED

ExecuteFlg = MACRO_ENABLED


void IRQ_Handler(void)
{
  if(ExecuteFlg)
  {
    // My handler code
  }
  else if
  {
    // User handler callback function
  }

}

is there any other way to achieve this???

Parents
  • Some IDEs providers (like Keil), some developer and third parties provide libraries. How do they achieve this??

    Did you read that line before hitting the post button?

    Or do they just give a compiled code library with all the functions (at expense of consuming more code area)??

    You need to read up on how a library is linked into a project.

    Is there a need of more intelligent library generator tools?? Has it been ages since someone thought about modifying the compiling-linking process??

    You definitely need to read up on how a library is linked into a project.

Reply
  • Some IDEs providers (like Keil), some developer and third parties provide libraries. How do they achieve this??

    Did you read that line before hitting the post button?

    Or do they just give a compiled code library with all the functions (at expense of consuming more code area)??

    You need to read up on how a library is linked into a project.

    Is there a need of more intelligent library generator tools?? Has it been ages since someone thought about modifying the compiling-linking process??

    You definitely need to read up on how a library is linked into a project.

Children
No data