home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / msdos / programm / 9249 < prev    next >
Encoding:
Text File  |  1992-09-10  |  1.8 KB  |  44 lines

  1. Xref: sparky comp.os.msdos.programmer:9249 alt.msdos.programmer:2342
  2. Newsgroups: comp.os.msdos.programmer,alt.msdos.programmer
  3. Path: sparky!uunet!cs.utexas.edu!sun-barr!ames!haven.umd.edu!darwin.sura.net!wupost!uwm.edu!rpi!zaphod.mps.ohio-state.edu!menudo.uh.edu!cosc16to
  4. From: cosc16to@menudo.uh.edu (Andy Hakim)
  5. Subject: Re: Turbo C++--forcing vars into CSEG
  6. Message-ID: <1992Sep10.234626.16207@menudo.uh.edu>
  7. Organization: University of Houston
  8. X-Newsreader: Tin 1.1 PL4
  9. References: <1992Sep8.195918.22762@umr.edu>
  10. Date: Thu, 10 Sep 1992 23:46:26 GMT
  11. Lines: 31
  12.  
  13. In Borland C++ the following method works:
  14.  
  15. Normally, the C compiler creates different segment names and classes
  16. for various parts of your program, something like:
  17.  
  18.   DEFAULT NAMES                               NEW NAMES
  19.    segment                                     segment
  20. name     class                              name     class
  21. --------------                              --------------
  22. CODE     _TEXT                              CODE     _TEXT
  23. DATA     _DATA   (initialized data)         CODE     _TEXT
  24. BSS      _BSS    (uninitialized data)       CODE     _TEXT
  25.  
  26. Since you can rename these default values using BC's -z command line
  27. option (maybe also using the IDE by some weird menu option)
  28. set both those data segment values to CODE and _TEXT and they will wind
  29. up in the cseg.  And compile via assembly.
  30.  
  31. This trick at least works in the tiny and small models, other models may
  32. require additional groups to be changed.  If you wish to place just
  33. a specific variable in the cseg, then you must compile to assembly
  34. and tweak the asm file manually.
  35.  
  36. example:
  37. CFLAGS = -mt -zACODE -zBCODE -zTCODE -zC_TEXT -zD_TEXT -zR_TEXT
  38.  
  39. Borland may be correct in saying that doing this may cause problems
  40. with overlaying, but it CAN be done.
  41.  
  42. -andy
  43. ahakim@uh.edu
  44.