cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/14/16:00:40

Sender: nate AT cartsys DOT com
Message-ID: <364DEBDA.928C79F2@cartsys.com>
Date: Sat, 14 Nov 1998 12:45:14 -0800
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.35 i486)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: size of a function in memory
References: <19981112170856 DOT 18464 DOT 00000989 AT ng-fi1 DOT aol DOT com> <3KL22.2159$vl4 DOT 1265858 AT tundra DOT ops DOT attcanada DOT net>
Reply-To: djgpp AT delorie DOT com

DeHackEd wrote:
> 
> Do you mean the size of a pointer to a function or the length of a function
> based on it's size?
> 
> If you mean the total function size, use what Allegro does:
> 
> void yourfunction()
> {
>     // insert commands here
> }
> 
> void end_of_function()
> {
> }
> 
> size = end_of_function - yourfunction;
> 
> Give or take a few overhead bytes.

Be aware that this is not portable.  It depends fairly strongly on GCC's
compiling conventions and may fail on other compilers, or even some
future version of GCC.  If it's for something like memory locking that
isn't portable anyway, though, this probably isn't much of an issue.
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019