home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / c / setlink.arc / SETLINK.DOC < prev   
Encoding:
Text File  |  1989-08-04  |  2.4 KB  |  47 lines

  1.  
  2.  
  3.  
  4.                                SETLINK
  5.                 Ted H. Emigh, emigh@ncsugn.ncsu.edu
  6.                            4 August 1989
  7.  
  8.      One of the limitations of DOS that I encounter in developing 
  9. software using Turbo C is the length of the command line 
  10. available.  I often have over a dozen program source files which 
  11. need to be linked.  In order to link these files together I would 
  12. need a command line whose length is well over the DOS limit of 
  13. 128 characters.  Borland has a partial solution to the problem by 
  14. allowing the linker to take its commands from a file.  The 
  15. command becomes:
  16.                         tlink @makefile.lnk
  17. where makefile.lnk (or whatever name you choose) contains the 
  18. linker commands.  While this helps, it is not a complete 
  19. solution.
  20.      A problem arises in using make with a makefile.  The list of 
  21. files to be linked needs to be listed in both makefile and 
  22. makefile.lnk.  This opens the possibility of a mistake when 
  23. source files are added and deleted or when changing the memory 
  24. model.  I prefer to have the files listed in makefile along with 
  25. the memory model and any other information needed, and have make 
  26. create makefile.lnk.  Unfortunately, make does not allow for 
  27. output redirection, so I cannot use echo ... >makefile.lnk.
  28.      To solve this problem, I have developed a short program, 
  29. setlink (see setlink.c), to make up for make's lack of output 
  30. redirection.  setlink merely takes the rest of the command line 
  31. and adds it to the specified file.  It is useful to identify 
  32. which setlink call in the makefile will be the first and so 
  33. identify when to create the file and when to append to the file.  
  34. In addition, I have added an option to use a user supplied name.  
  35. I have written setlink to minimize program size, so have used 
  36. some atypical program fragments.
  37.      The command setlink has the following usage:
  38.      setlink -n[filename]|-a[filename] [optional command line]
  39. One of the options -n (for new file) or -a (for append to file) 
  40. is required.  If a file name is given following -n or -a (without 
  41. a space between the file name and the option), then that file is 
  42. used, otherwise makefile.lnk is used.  The remainder of the 
  43. command line, containing linker commands and options, is written 
  44. to the file makefile.lnk.
  45.      As an example of the usage, the MAKEFILE is the makefile for 
  46. setlink.
  47.