Application Programming Interfaces

This is a discussion on Application Programming Interfaces within the C Programming forums, part of the General Programming Boards category; While working on an assignment I am asked to implement several APIs. I am wondering what this means, as they ...

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    3

    Application Programming Interfaces

    While working on an assignment I am asked to implement several APIs. I am wondering what this means, as they are described as functions. What steps should I take to write an API, and how would this effect my actual program?

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,506
    Basically, you're supposed to create a library of functions with some common theme.

    For example, a graphics library would have circle, line, colour functions.

    The group of functions you provide form an API.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Oct 2011
    Posts
    3
    Alright, that seems to make sense. If I then wanted to call that set of functions, I'd need to have them in some .h file? Thanks for your help.

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Laver View Post
    Alright, that seems to make sense. If I then wanted to call that set of functions, I'd need to have them in some .h file? Thanks for your help.
    Yes. You need .h's available as #includes for users of the API.

    As Salem implies, an API generally belongs to a library. I think the simplest definition of a library WRT to C is that it is an executable object compiled from source without a main(), with the intention that it be linked to (used by) another executable object that does have a main() (and so is a full fledged "application").

    So you write the library, and the API is basically the list of functions, types, etc. available to anyone who wants to write an application using that library. For example, the C API is all the functions, types, etc that are part of the standard C library.
    Last edited by MK27; 10-24-2011 at 09:50 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #5
    Registered User
    Join Date
    Oct 2011
    Posts
    3
    Alright, I think I have a good grip on what an API is and how to use/implement it, thanks again for both of your help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 06-12-2006, 03:51 PM
  2. Replies: 20
    Last Post: 12-09-2004, 06:52 PM
  3. Internet Application Programming
    By Unregistered in forum C++ Programming
    Replies: 6
    Last Post: 08-14-2002, 02:23 AM
  4. Interfaces...
    By netboy in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 07-08-2002, 06:55 AM
  5. C++ programming application
    By Unregistered in forum C++ Programming
    Replies: 9
    Last Post: 06-11-2002, 01:45 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21