home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.os.msdos.programmer:9249 alt.msdos.programmer:2342
- Newsgroups: comp.os.msdos.programmer,alt.msdos.programmer
- 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
- From: cosc16to@menudo.uh.edu (Andy Hakim)
- Subject: Re: Turbo C++--forcing vars into CSEG
- Message-ID: <1992Sep10.234626.16207@menudo.uh.edu>
- Organization: University of Houston
- X-Newsreader: Tin 1.1 PL4
- References: <1992Sep8.195918.22762@umr.edu>
- Date: Thu, 10 Sep 1992 23:46:26 GMT
- Lines: 31
-
- In Borland C++ the following method works:
-
- Normally, the C compiler creates different segment names and classes
- for various parts of your program, something like:
-
- DEFAULT NAMES NEW NAMES
- segment segment
- name class name class
- -------------- --------------
- CODE _TEXT CODE _TEXT
- DATA _DATA (initialized data) CODE _TEXT
- BSS _BSS (uninitialized data) CODE _TEXT
-
- Since you can rename these default values using BC's -z command line
- option (maybe also using the IDE by some weird menu option)
- set both those data segment values to CODE and _TEXT and they will wind
- up in the cseg. And compile via assembly.
-
- This trick at least works in the tiny and small models, other models may
- require additional groups to be changed. If you wish to place just
- a specific variable in the cseg, then you must compile to assembly
- and tweak the asm file manually.
-
- example:
- CFLAGS = -mt -zACODE -zBCODE -zTCODE -zC_TEXT -zD_TEXT -zR_TEXT
-
- Borland may be correct in saying that doing this may cause problems
- with overlaying, but it CAN be done.
-
- -andy
- ahakim@uh.edu
-