Creating library files in C

Discussion in 'Programmer's Corner' started by Santosh_16k, Sep 30, 2012.

  1. Santosh_16k

    Thread Starter New Member

    Aug 19, 2011
    I wished to create my own library files for LCD n timers of ATmega128. I use AVR studio to program. Can you tell me how should I create library files, so that while coding I just include them in the code?
  2. Brownout

    Well-Known Member

    Jan 10, 2012
    I don't use AVR studio, however most of the programming environments I do use have procedures for creating libraries, so I suggest you find the section in your documentation that describes library creation. Otherwise, you can just create a directory on your development system where you put library files and just statically link them.
  3. MrChips


    Oct 2, 2009
    Create your own library file and give it a name such as "mylib.c"

    Just include the library in your program using:

    #include "mylib.c"
  4. kubeek

    AAC Fanatic!

    Sep 20, 2005
    Look here, beasically .h file should contain declarations of functions in .c.
    The .h file should have the guard mechanism described in the wiki article so that you can include one header file in different others and prevent double declaration of the functions.