get size of function

Johannes Pfau spam at example.com
Tue Aug 30 14:30:38 PDT 2011


maarten van damme wrote:
>I'm playing around with writing memory to other processes and now I
>want to write a whole function to the other processes memory. The
>problem is that function.sizeof always returns 4. Is there a way to
>get the actual size?
>
You could use the same hacks as in C:
Declare another function, make sure their located sequentially in
memory and compare their function addresses to get the size of the first
function (+ potential padding for alignment, but that shouldn't matter).

I do not recommend to do this though, it's a baaaad hack, and I don't
even remember how exactly it worked.

-- 
Johannes Pfau



More information about the Digitalmars-d-learn mailing list