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.
- 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.