Mail Archives: djgpp/1998/11/14/16:00:40
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 -