Thread: Build my own *.lib

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    1

    Question Build my own *.lib

    Hi i would like to build a library of my own functions, because i used so often, so is not very cool to make copy paste the code. I using borland 5.5 command line to copile ansi c programms. Can you help me to create a lib. I don`t know how to work with tlib. I hope you can help me in this because i´m too newbie. Thanks.
    See you later.

    Markitos

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    • Place all of your function prototypes (and classes for c++) in a header file.
    • Do not instantiate structs/classes, use global variables, etc., or this will cause a duplicate symbol when you include your header.
    • Include the header file in your source module.
    • Ensure that your source is just a lot of function definitions. No main function is allowed since only one main is allowed per program.
    • Compile all of this to an .OBJ module or object module.
    • Use TLIB <path> [+ or -] <objectmodule.obj>
    • For instance:

      Library called myfuncs.lib

      TLIB myfuncs.lib +myfuncs.obj

      This will tell TLIB to create myfuncs.lib and add object module myfuncs.obj. This will produce: myfuncs.lib
      To remove object module from myfunc.lib:
      TLIB myfuncs.lib -myfuncs.obj

    • To use myfuncs.lib in your program(s):
    • include the correct header, in this case myfuncs.h
    • In your project, make sure that you have myfuncs.lib.
    • Project:
      -anything.exe
      - anything.c
      - myfuncs.lib

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. PlaySound
    By cangel in forum C++ Programming
    Replies: 16
    Last Post: 10-08-2009, 05:29 PM
  2. How to build, run Boland C++ 6 source file via VS2005?
    By userpingz in forum C++ Programming
    Replies: 2
    Last Post: 05-21-2009, 03:25 AM
  3. Replies: 0
    Last Post: 10-07-2008, 12:09 PM
  4. Replies: 0
    Last Post: 09-24-2006, 06:26 AM
  5. Boom, Headoshot!!
    By mrafcho001 in forum A Brief History of Cprogramming.com
    Replies: 50
    Last Post: 07-21-2005, 08:28 PM