problem in creating a library

Hi

I want to create a library (.lib) for such a function:

#define baud 19200
#define fpclk 12000000

void setbaud (void);


as a header file (set.h) and

void setbaud (void){
unsigned short int a=(fpclk/16/baud);
.
.
.
}


as a .c file (set.c).

compiler gives me a .lib file format and I've add it to my UVproject

and every thing is OK but when I try to write a new #define for baud and fpclk, compiler can compile without any error or warning but every thing is fixed same as those definitions which are mentioned in library(here they're always 19200 and 12000000).

if I remove them in library I'll get an error.

how can I set my library to get such information from outside of library.
(Rl-ARM is in this way without any kind of problem)

thanks in advance

Parents
  • Time for you to study C.

    Time to you to figure out difference between preprocessing, compile time and run time.

    How the xx do you think you can build a function and then later change the preprocessor symbols and have the already compiled code to suddenly and magically recompile itself to behave completely differently?

    Runtime makes use of parameters or global variables. A #define is not a variable, so it is not processed during runtime but represents input to the compiler during the compilation stage.

    You really should get a good book on the C language.

Reply
  • Time for you to study C.

    Time to you to figure out difference between preprocessing, compile time and run time.

    How the xx do you think you can build a function and then later change the preprocessor symbols and have the already compiled code to suddenly and magically recompile itself to behave completely differently?

    Runtime makes use of parameters or global variables. A #define is not a variable, so it is not processed during runtime but represents input to the compiler during the compilation stage.

    You really should get a good book on the C language.

Children
More questions in this forum