| delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
| Date: | Wed, 2 Feb 2005 17:47:28 -0500 |
| Message-Id: | <200502022247.j12MlSKI019716@envy.delorie.com> |
| From: | DJ Delorie <dj AT delorie DOT com> |
| To: | gordon_schumacher AT maxtor DOT com |
| CC: | djgpp AT delorie DOT com |
| In-reply-to: | <71078E41DDE3E541B024832F34BC3D0D4BBE5F@cowexc03.corp.mxtr.net> |
| (gordon_schumacher AT maxtor DOT com) | |
| Subject: | Re: Can a *program* know its size and location of code? |
| References: | <71078E41DDE3E541B024832F34BC3D0D4BBE5F AT cowexc03 DOT corp DOT mxtr DOT net> |
| Errors-To: | nobody AT delorie DOT com |
| X-Mailing-List: | djgpp AT delorie DOT com |
| X-Unsubscribes-To: | listserv AT delorie DOT com |
Look for symbols like _text and _etect (use "nm -n prog.ex" to find
them. Their *addresses* demark your program areas, so code like:
extern char _etext, _text;
...
progsize = &etext - &text;
Alternately, declare them as arrays of char and treat them
like they *are* your program:
extern char _text[];
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |