Source code of a method.
Baz
burg.basile at yahoo.com
Mon Nov 4 07:11:48 PST 2013
On Monday, 4 November 2013 at 15:09:38 UTC, Baz wrote:
> On Saturday, 26 October 2013 at 16:36:35 UTC, TheFlyingFiddle
> wrote:
>> Is there a way to extract the source code of a method at
>> compiletime?
>
> Yep, at least on win32. (tested in win7 32 with DEP set to "ON"
> for everything)
>
> http://dpaste.dzfl.pl/19c77eee
>
> It doesn't run on DPaste (linux x86_64) that's why I restrict
> the "yes" to my own local test (on win32).
>
> basically:
> - set memory mode for reading code and grab it.
> - transform. (in my example I patch a bool as return value).
> - set memory mode for writing and patch it with your
> "patched-grabed-code".
> - call new code.
>
> :)
And also: flush the instruction cache too ^^
More information about the Digitalmars-d-learn
mailing list