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

How to use library?

I use uVision2 of Windows version.

How to create my own library and how to use it when linking?

Parents
  • Actually, that is real 'C'

    Unless advised otherwise (eg, by a function prototype) 'C' assumes that all functions return int and take no parameters [1].

    Therefore you can call library functions without specifying a prototype provided that they take no parameters and the return value is either not used, or is assignment-compatible with 'int'.

    You must provide a prototype if you want your library function to take any parameters, or you'll get error C267, "requires ANSI-style prototype"

    But it's always good practice to provide function prototypes, as this gives the compiler the chance to warn you of type mismatches.

    [1] kernighan & Ritchie
    "The C Programming Language, 2/ed"
    Prentice-Hall, 1988.

Reply
  • Actually, that is real 'C'

    Unless advised otherwise (eg, by a function prototype) 'C' assumes that all functions return int and take no parameters [1].

    Therefore you can call library functions without specifying a prototype provided that they take no parameters and the return value is either not used, or is assignment-compatible with 'int'.

    You must provide a prototype if you want your library function to take any parameters, or you'll get error C267, "requires ANSI-style prototype"

    But it's always good practice to provide function prototypes, as this gives the compiler the chance to warn you of type mismatches.

    [1] kernighan & Ritchie
    "The C Programming Language, 2/ed"
    Prentice-Hall, 1988.

Children