Thread: need to introdude my own function as standard

  1. #1
    Unregistered
    Guest

    need to introdude my own function as standard

    ive written a few functions which i wanna use in all programs of mine
    how do i make them standard functions in C compiler so that i can just pik em off by their names?

    also if i write a program and a function in a seperate file,
    how do i run the function from the prog?
    plz help

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    >>> how do i make them standard functions in C compiler

    "standard" functions are not in the compiler, but in a library which is linked to your compiled source by the linker. If you want to do the same thing, make a library with your functions in it and then link your code with that library.

    >>> if i write a program and a function in a seperate file,
    how do i run the function from the prog?

    When you compile two or more source files, it is the linker that puts them together. As long as you have your pototypes correctly stated, i.e.that both files know what is what, you can call the function as if it were in the same file as your main().

    The details of how to acheive these things is compiler specific.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Change this program so it uses function??
    By stormfront in forum C Programming
    Replies: 8
    Last Post: 11-01-2005, 08:55 AM
  3. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 06:44 PM
  4. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM
  5. Replies: 5
    Last Post: 02-08-2003, 07:42 PM