|
Compiling Compiling Code C Implementation C++ Implementation Language Extensions Mixing Languages Assembly Language Inline Assembler Optimizing Code Numerics Programming Regular Expressions Acrtused Pragmas Precompiled Headers Predefined Macros Warning Messages Error Messages Runtime Messages Linking Optlink Switches Module Definition Files Operation and Design Error Messages Win32 Programming Win32 Programming DOS and Win16 Programming Memory Models 16 Bit Pointer Types and Type Modifiers Handle Pointers DOS DOS 32 (DOSX) Win16 Win16 DLLs Win16 Prolog/Epilog C/C++ Extensions Contract Programming __debug statement __debug declaration Dynamic Profiling Embedding C in HTML Tools BCC CHMOD CL COFF2OMF COFFIMPLIB DMC DIFF DIFFDIR DUMP DUMPOBJ DUMPEXE EXE2BIN FLPYIMG GREP HC IMPLIB LIB LIBUNRES MAKE MAKEDEP ME OBJ2ASM PATCHOBJ RC RCC SC SHELL SMAKE TOUCH UNMANGLE WHEREIS Porting to DMC++ Switching to DMC++ from Microsoft from Borland Porting Guide |
LIB: Object File LibrarianA library manager is a utility that maintains object library files. Object libraries are collections of related object (.obj) files, such as a set of graphics functions, or the run-time libraries supplied with this compiler. Object libraries are useful for linking them as a single, convenient file, rather than as many separate files. Creating an object library does not change the contents of the object files or how they work. A library just gathers object files in one place.Use LIB to create, maintain, and customize object library files. LIB enables putting objects into libraries, replacing objects with newer versions, deleting objects from libraries, and extracting objects from libraries. LIB can generate a text listing of the contents of a library. LIB handles both 16-and 32-bit object files in Intel OMF format. LIB command syntaxlib switches... libfile objfiles...
Backup LibrariesIf a library file is modified or rewritten, an existing library file of the same name is renamed to a file with a .bak extension. (This action is disabled with the -n switch.) Any previous file of the same name with the .bak extension is deleted.Exampleslib -hPrint help message. lib foo a b c.objCreate a library foo.lib and insert the object files a.obj b.obj and c.obj. lib -l fooCreate listing file foo.lst of contents of foo.lib. lib -d foo.lib aDelete the object a.obj from foo.lib. lib -x foo.lib bExtract the object b.obj from foo.lib and write it to file b.obj. lib foo.lib bar.lib a.objAdd the contents of bar.lib and a.obj to foo.lib. Using LIB with SMAKEThe usual technique is:OBJS=a.obj b.obj c.obj foo.lib : lib -c foo.libIf the list of OBJS gets too long for the command line, SMAKE can automatically create a response file. Use an SMAKE command like: OBJS=a.obj b.obj c.obj foo.lib : lib -c foo.lib \ @<< << Using LIB with MAKEThe usual technique is:OBJS=a.obj b.obj c.obj foo.lib : lib -c foo.libIf the list of OBJS gets too long for the command line, MAKE will automatically create a response file that LIB will use. Obsolete LIB command syntaxFor compatibility with older makefiles and batch files, LIB supports an older command line syntax. Such makefiles should be upgraded to the new command syntax.Arguments are passed to LIB via:
lib lib-file [switches][action-files],[list-file][;]lib-file is the name of the library file to create or change. Its default file extension is .lib. The switches are:
To specify what to do with each object file, put one of the following switches before the name(s) of the action-files:
Concatenating librariesTo concatenate two libraries, specify one as the lib-file and the other as an action-file. LIB adds the modules from the action-file library to the other library without changing the names of the modules.Note: LIB doesn't allow two modules to contain the same public symbol. Using LIB interactivelyIf LIB is run with no arguments, it prompts for the required arguments. Use the ampersand (&) character to continue input on a new line.Response filesYou can use LIB with a response file, which contains the responses that the compiler would ask for if used interactively. For example, the response file below adds several objects to the library mywindow.lib and produces a listing file:\dm\lib\mywindow.lib /c +winopen+winblank+winmove+winhide& +winshow+winputs+wingets+winprint \dm\mywin.lst;If the response file is makewin.rsp, use LIB like this: lib @makewin.rspDon't use filenames beginning with @ because LIB mistakes it for a response file. Using LIB with SMAKEThe usual technique is:OBJS=a.obj b.obj c.obj foo.lib : -del foo.lib lib foo.lib/C/NOI +a+b+c;If the list of OBJS gets too long for the command line, SMAKE can automatically create a response file. Use an SMAKE command like: OBJS=a.obj b.obj c.obj foo.lib : -del foo.lib lib foo.lib/C/NOI \ @<< +a& +b& +c; << Using LIB with MAKEThe usual technique is:OBJS=a.obj b.obj c.obj foo.lib : -del foo.lib lib foo.lib/C/NOI +a+b+c;If the list of OBJS gets too long for the command line, use multiple LIB commands: OBJS=a.obj b.obj c.obj foo.lib : -del foo.lib lib foo.lib/C/NOI +a+b; lib foo.lib/NOI +c; Bugs
|